// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        vector<short> v(k+1, 0);
        fin()
        {
            ll temp;
            cin >> temp;
            v[temp] = 1;
        }
        ll i = k;
        v[i] = 1;
        v[0] = 1;
        while(true)
        {
            if(i <= 2) break;
            if(v[i] != v[i-1])
            {
                v[i-1] = 1;
                --i;
            }
            else if(v[i] == v[i-2])
            {
                i -= 2;
            }
            else
            {
                ++cnt;
                v[i-2] = 1;
                i -= 2;
            }
        }
        cout << cnt << endl;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        queue<ll> q;
        forn(i, n)
        {
            ll temp;
            cin >> temp;
            q.push(temp);
        }
        ll i = k;
        while(true)
        {
            if(i <= 2 || q.empty()) break;
            ll next = q.front();
            if(abs(i - next) == 0)
            {
                q.pop();
                continue;
            }
            else if(abs(i - next) == 2)
            {
                --i;
            }
            else if(abs(i - next) == 1)
            {
                q.pop();
                --i;
                if(!q.empty() && i - q.front() != 1)
                {
                    ++cnt;
                    q.pop();
                    --i;
                }
                else if(!q.empty() && i - q.front() == 1)
                {
                    --i;
                    q.pop();
                }
            }
            else
            {
                i -= 2;
                ++cnt;
            }
        }
        while(i > 2)
        {
            i -= 2;
            ++cnt;
        }
        cout << cnt << endl;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        unordered_map<ll, ll, custom_hash> v;
        forn(i, k+1)
        {
            v[i] = 0;
        }
        fin()
        {
            ll temp;
            cin >> temp;
            v[temp] = 1;
        }
        ll i = k;
        v[i] = 1;
        v[0] = 1;
        while(true)
        {
            if(i <= 2) break;
            if(v[i] != v[i-1])
            {
                v[i-1] = 1;
                --i;
            }
            else if(v[i] == v[i-2])
            {
                i -= 2;
            }
            else
            {
                ++cnt;
                v[i-2] = 1;
                i -= 2;
            }
        }
        cout << cnt << endl;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        vector<short> v(k, 0);
        fin()
        {
            ll temp;
            cin >> temp;
            v[temp-1] = 1;
        }
        ll i = k-1;
        v[i] = 1;
        while(true)
        {
            if(i <= 2) break;
            if(v[i] != v[i-1])
            {
                v[i-1] ^= 1;
                --i;
            }
            else if(v[i] == v[i-2])
            {
                i -= 2;
            }
            else
            {
                ++cnt;
                v[i-2] = 1;
                i -= 2;
            }
        }
        cout << cnt << endl;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        ll i = k;
        ll next = 0;
        while(true)
        {
            if(i <= 2 || n <= 0) break;
            if(!flag)
            {
                cin >> next;
                --n;
            }

            if(i - next == 0)
            {
                flag = 0;
                continue;
            }
            else if(i - next == 1)
            {
                flag = 0;
                if(n) cin >> next;
                --n;
                --i;
                if(n == -1)
                {
                    ++cnt;
                }
                else if(i - next != 1)
                {
                    ++cnt;
                    flag = 1;
                    --i;
                }
                else if(i - next == 1)
                {
                    --i;
                }
            }
            else
            {
                --i;
            }
        }
        cout << cnt << endl;
        flag = 0;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        vector<ll> v(k+1, 0);
        fin()
        {
            ll temp;
            cin >> temp;
            v[temp] = 1;
        }
        ll i = k;
        v[i] = 1;
        v[0] = 1;
        while(true)
        {
            if(i <= 2) break;
            if(v[i] != v[i-1])
            {
                v[i-1] = 1;
                --i;
            }
            else if(v[i] == v[i-2])
            {
                i -= 2;
            }
            else
            {
                ++cnt;
                v[i-2] = 1;
                i -= 2;
            }
        }
        cout << cnt << endl;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


// #define FILE_INPUT
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;
typedef pair<ll, ll> pll;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vll;

#define pb push_back
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornm(i, m, n) for(ll i = m; i < n; ++i)
#define rfornm(i, m, n) for(ll i = m; i >= n; --i)
#define fin() for(ll i = 0; i < n; ++i)
#define readvec(vector, n) {ll temp_vec_val;forn(i, n){cin >> temp_vec_val;vector.push_back(temp_vec_val);}}
#define printvec(vector, delimeter) {ll length_of_vector=vector.size();\
                                    forn(i, length_of_vector){cout << vector[i] << delimeter;}}
#define sortvec(vector) sort(vector.begin(), vector.end())

struct custom_hash
{
    static uint64_t splitmix64(uint64_t x)
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

unsigned long long bpow(unsigned long long a, int n)
{
    return n ? n & 1 ? bpow(a, n - 1) * a : bpow(a * a, n >> 1) : 1;
}

bool is_upper(char c)
{
    return (c >= 65 && c <= 90); //ascii
}

bool is_lower(char c)
{
    return (c >= 97 && c <= 122); //ascii
}

int get_digit(ll num, int len, int index)
{
    return num / bpow(10, len - index - 1) % 10;
}

ll digit_sum(ll num)
{
    ll dig_sum = 0;
    while(num > 0)
    {
        dig_sum += num % 10;
        num /= 10;
    }
    return dig_sum;
}

const int INF = 1e9 + 7;
const double pi = 2 * acos(0.0);
ll n, m, k, p, q, sum = 0, cnt = 0;
ll mx = INT64_MIN;
ll mn = INT64_MAX;
bool flag = 0;
vll v;
str s = "", s1, s2;

void solve() //n&1 == 0 <=> n % 2 == 0
{
    cin >> m;
    forn(_, m)
    {
        cin >> k >> n;
        queue<ll> q;
        forn(i, n)
        {
            ll temp;
            cin >> temp;
            q.push(temp);
        }
        ll i = k;
        while(true)
        {
            if(i <= 2 || q.empty()) break;
            ll next = q.front();
            if(i - next == 0)
            {
                q.pop();
                continue;
            }
            else if(i - next == 2)
            {
                --i;
            }
            else if(i - next == 1)
            {
                q.pop();
                --i;
                if(!q.empty() && i - q.front() != 1)
                {
                    ++cnt;
                    q.pop();
                    --i;
                }
                else if(!q.empty() && i - q.front() == 1)
                {
                    --i;
                    q.pop();
                }
            }
            else
            {
                i -= 2;
                ++cnt;
            }
        }
        if(i > 2)
        {
            cnt += ceil(((dbl)i - 2.0) / 2.0);
        }
        cout << cnt << endl;
        cnt = 0;
    }
}

int main()
{
#ifdef FILE_INPUT
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    // cout.precision(19);
    ios::sync_with_stdio(0);
    cin.tie(0);

    solve();

//  memset(v, INT_MAX, 1000*2000*sizeof(int));

    return 0;
}


#include <bits/stdc++.h>

//MEII SIMPLE
//C MEII
//MEII MEII

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define fore(i,a,b) for (ll i=a,ThxDem=b;i<ThxDem;i++)
#define ford(i,a,b) for (ll i=a,ThxDem=b;i>ThxDem;i--)
#define pb push_back
#define ALL(s) s.begin(),s.end()

typedef unsigned long long ull;
typedef long long ll;
const ll MAXN= 100005;
typedef pair<ll,ll> pii;

const ll mod= 1e9+7;

int h,n,pos,q,x,cnt;
map<int,int> p;

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> q;
    while(q--){
        cnt=0;
        cin >> h>>n;
        p.clear();
        fore(i,0,n) cin >> x,p[x]=1;
        pos=h;
        while (pos>0){
            if (p[pos-1]==0) pos--;
            else {
                pos-=2;
                if (pos==0) break;
                if (p[pos]==0) cnt++;
            }
        }
        cout << cnt<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

//MEII SIMPLE
//C MEII
//MEII MEII

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define fore(i,a,b) for (ll i=a,ThxDem=b;i<ThxDem;i++)
#define ford(i,a,b) for (ll i=a,ThxDem=b;i>ThxDem;i--)
#define pb push_back
#define ALL(s) s.begin(),s.end()

typedef unsigned long long ull;
typedef long long ll;
const ll MAXN= 100005;
typedef pair<ll,ll> pii;

const ll mod= 1e9+7;

ll h,n,pos,q,x,cnt;
ll p[2*MAXN];

int b_search(ll l,ll r, ll val){
    while (l<=r){
        ll mid = (l+r)/2;
        if (p[mid]==val) return 1;
        else {
            if (p[mid]>val) l=mid+1;
            else r=mid-1;
        }
    }
    return -1;
}

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> q;
    while(q--){
        cnt=0;
        cin >> h>>n;
        fore(i,0,n) cin >> p[i];
        pos=h;
        while (pos>0){
            if (b_search(0,n-1,pos-1)==-1) pos--;
            else {
                pos-=2;
                if (pos==0) break;
                if (b_search(0,n-1,pos)==-1) cnt++;
            }
        }
        cout << cnt<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

//MEII SIMPLE
//C MEII
//MEII MEII

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define fore(i,a,b) for (ll i=a,ThxDem=b;i<ThxDem;i++)
#define ford(i,a,b) for (ll i=a,ThxDem=b;i>ThxDem;i--)
#define pb push_back
#define ALL(s) s.begin(),s.end()

typedef unsigned long long ull;
typedef long long ll;
const ll MAXN= 100005;
typedef pair<ll,ll> pii;

const ll mod= 1e9+7;

ll h,n,pos,q,x,cnt;

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> q;
    while(q--){
        cnt=0;
        cin >> h>>n;
        map<ll,int> p;
        fore(i,0,n) cin >> x,p[x]=1;
        pos=h;
        while (pos>0){
            if (p[pos-1]==0) pos--;
            else {
                pos-=2;
                if (pos==0) break;
                if (p[pos]==0) cnt++;
            }
        }
        cout << cnt<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

//MEII SIMPLE
//C MEII
//MEII MEII

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define fore(i,a,b) for (ll i=a,ThxDem=b;i<ThxDem;i++)
#define ford(i,a,b) for (ll i=a,ThxDem=b;i>ThxDem;i--)
#define pb push_back
#define ALL(s) s.begin(),s.end()

typedef unsigned long long ull;
typedef long long ll;
const ll MAXN= 100005;
typedef pair<ll,ll> pii;

const ll mod= 1e9+7;

ll h,n,pos,q,x,cnt;

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> q;
    while(q--){
        cnt=0;
        cin >> h>>n;
        ll p[h+5]={0};
        fore(i,0,n) cin >> x,p[x]=1;
        pos=h;
        while (pos>0){
            if (p[pos-1]==0) pos--;
            else {
                pos-=2;
                if (pos==0) break;
                if (p[pos]==0) cnt++;
            }
        }
        cout << cnt<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

//MEII SIMPLE
//C MEII
//MEII MEII

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define fore(i,a,b) for (ll i=a,ThxDem=b;i<ThxDem;i++)
#define ford(i,a,b) for (ll i=a,ThxDem=b;i>ThxDem;i--)
#define pb push_back
#define ALL(s) s.begin(),s.end()

typedef unsigned long long ull;
typedef long long ll;
const ll MAXN= 100005;
typedef pair<ll,ll> pii;

const ll mod= 1e9+7;

ll h,n,pos,q,x,cnt;
ll p[2*MAXN];

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> q;
    while(q--){
        cnt=0;
        cin >> h>>n;
        fore(i,0,n) cin >> p[i];
        p[n]=0;
        fore(i,0,n){
            if (i<n-1){
                if (p[i+1]-p[i+2]==1) i++;
                else cnt++;
            }
        }
        cout << cnt<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

//MEII SIMPLE
//C MEII
//MEII MEII

using namespace std;

#define endl '\n'
#define fi first
#define se second
#define mp(x,y) make_pair(x,y)
#define fore(i,a,b) for (ll i=a,ThxDem=b;i<ThxDem;i++)
#define ford(i,a,b) for (ll i=a,ThxDem=b;i>ThxDem;i--)
#define pb push_back
#define ALL(s) s.begin(),s.end()

typedef unsigned long long ull;
typedef long long ll;
const ll MAXN= 100005;
typedef pair<ll,ll> pii;

const ll mod= 1e9+7;

ll h,n,pos,q,x,cnt;
ll p[2*MAXN];

int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin >> q;
    while(q--){
        cnt=0;
        cin >> h>>n;
        fore(i,0,n) cin >> p[i];
        pos=h;
        int ii=0;
        while (pos>=0){
            if (p[ii+1]<pos-1) pos--;
            else {
                ii++;
                pos-=2;
                if (pos==0) break;
                if (p[ii+1]<pos) cnt++;
                else ii++;
            }
        }
        cout << cnt<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int t;
	cin >> t;
	while (t--) {
		int n, m;
		string s;
		cin >> n >> m >> s;
		vector<int> pref(n);
		for (int i = 0; i < m; ++i) {
			int p;
			cin >> p;
			++pref[p - 1];
		}
		for (int i = n - 1; i > 0; --i) {
			pref[i - 1] += pref[i];
		}
		vector<int> ans(26);
		for (int i = 0; i < n; ++i) {
			ans[s[i] - 'a'] += pref[i];
			++ans[s[i] - 'a'];
		}
		for (int i = 0; i < 26; ++i) {
			cout << ans[i] << " ";
		}
		cout << endl;
	}

	return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {

	int t;
	cin >> t;
	while (t--) {
		int n, m;
		string s;
		cin >> n >> m >> s;
		vector<int> pref(n);
		for (int i = 0; i < m; ++i) {
			int p;
			cin >> p;
			++pref[p - 1];
		}
		for (int i = n - 1; i > 0; --i) {
			pref[i - 1] += pref[i];
		}
		vector<int> ans(26);
		for (int i = 0; i < n; ++i) {
			ans[s[i] - 'a'] += pref[i];
			++ans[s[i] - 'a'];
		}
		for (int i = 0; i < 26; ++i) {
			cout << ans[i] << " ";
		}
		cout << endl;
	}

	return 0;
}


#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
using namespace std;
/*int countG(vector<int> v, int k)
{
    if(lower_bound(v.begin(),v.end(),k)==v.end()){
        return 0;
    }
    return v.size()-(lower_bound(v.begin(),v.end(),k)-v.begin());

}*/
int main() {
    int t;
    cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;
        vector<int> p(m);
        string s;
        cin>>s;
        for(int i=0;i<m;i++){
            int x;
            cin>>x;
            p.push_back(x);
        }
        //cout<<countG(p,2)<<endl;
        sort(p.begin(),p.end());
        map<char,int> mp;
        for(int i=0;i<n;i++){
            {mp[s.at(i)]+=p.size()-(lower_bound(p.begin(),p.end(),i+1)-p.begin());;}
            //cout<<countG(p,i+1)<<" ";

        }
        for(int i=0;i<n;i++){
            mp[s.at(i)]++;
        }
        for(int i=0;i<26;i++){
            if(mp.find(char(i+97))==mp.end()){
                cout<<0<<" ";
            }
            else{
                cout<<mp[char(i+97)]<<" ";
            }
        }

        cout<<endl;

    }
}


import java.util.*;
public class sid
{
    public static void main(String args[])
    {
        int t,a,b;
        String s;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();

        for(int i=0;i<t;i++)
        {HashMap<Integer,Integer> map = new HashMap<>(26);
        map.put(0,0);
        map.put(1,0);
        map.put(2,0);
        map.put(3,0);
        map.put(4,0);
        map.put(5,0);
        map.put(6,0);
        map.put(7,0);
        map.put(8,0);
        map.put(9,0);
        map.put(10,0);
        map.put(11,0);
        map.put(12,0);
        map.put(13,0);
        map.put(14,0);
        map.put(15,0);
        map.put(16,0);
        map.put(17,0);
        map.put(18,0);
        map.put(19,0);
        map.put(20,0);
        map.put(21,0);
        map.put(22,0);
        map.put(23,0);
        map.put(24,0);
        map.put(25,0);
            a=sc.nextInt();
            b=sc.nextInt();
            s= sc.next();
            String str="";
            for(int j=0;j<b;j++)
            {  int d = sc.nextInt();
                str= str+s.substring(0,d);

            }
            for(int k=0;k<str.length();k++)
                {
                    char r= str.charAt(k);
                    int tr= r-97;
                    if(map.containsKey(tr))
                    map.put(tr,map.get(tr)+1);

                }
            for(int l=0;l<a;l++)
            {char r=s.charAt(l);
             int tr= r-97;
              if(map.containsKey(tr))
                    map.put(tr,map.get(tr)+1);
            }

            for(int h=0;h<26;h++)
            {
                System.out.print(map.get(h)+" ");
            }
            System.out.println();
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long

int t, n, m;
int dp[200005];
string s;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> t;
	while (t--) {
		cin >> n >> m >> s;
		for (int i = 0; i < m; i++) {
			int e;
			cin >> e;
			dp[e - 1]++;
		}
		dp[n - 1]++;
		for (int i = n - 2; i >= 0; i--)
			dp[i] += dp[i + 1];
		vector<int> as(26);
		for (int i = 0; i < n; i++) {
			as[s[i] - 'a'] += dp[i];
		}
		for (auto i : as)
			 cout << i << ' ';
		cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb            push_back
#define f             first
#define s             second
#define int           long long
#define double        long double
#define pii           pair<int,int>
#define vi            vector<int>
#define vii           vector<pii>
#define mi            map<int,int>
#define sz(x)         ((long long)x.size())
#define rep(a,b,c)    for(int a=b; a<=(c); a++)
#define per(a,b,c)    for(int a=b; a>=(c); a--)
#define trav(a,x)     for(auto &a:x)
#define all(a)        a.begin(),a.end()
#define endl          '\n'

void solve()
{
	int n, m;
	string s;
	cin >> n >> m >> s;
	vi p(n);
	rep (i, 0, m-1) {
		int x;
		cin >> x;
		p[x - 1]++;
	}
	per (i, n-2, 0) {
		p[i] += p[i + 1];
	}
	vi f(26);
	rep (i, 0, n-1) {
		f[s[i] - 'a'] += p[i] + 1;
	}
	trav (i, f) {
		cout << i << ' ';
	}
	cout << endl;
}

signed main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);
	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb            push_back
#define f             first
#define s             second
#define int           long long
#define double        long double
#define pii           pair<int,int>
#define vi            vector<int>
#define vii           vector<pii>
#define mi            map<int,int>
#define sz(x)         ((long long)x.size())
#define rep(a,b,c)    for(int a=b; a<=(c); a++)
#define per(a,b,c)    for(int a=b; a>=(c); a--)
#define trav(a,x)     for(auto &a:x)
#define all(a)        a.begin(),a.end()
#define endl          '\n'

void solve()
{
	int n, m;
	string s;
	cin >> n >> m >> s;
	vi p(n);
	rep (i, 0, m-1) {
		int x;
		cin >> x;
		p[x - 1]++;
	}
	per (i, n-2, 0) {
		p[i] += p[i + 1];
	}
	vi f(26);
	rep (i, 0, n-1) {
		f[s[i] - 'a'] += p[i] + 1;
	}
	trav (i, f) {
		cout << i << ' ';
	}
	cout << endl;
}

signed main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);
	int t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long

int t, n, m;
int dp[200005] ={0};
string s;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> t;
	while (t--) {
		cin >> n >> m >> s;
		for (int i = 0; i < m; i++) {
			int e;
			cin >> e;
			dp[e - 1]++;
		}
		dp[n - 1]++;
		for (int i = n - 2; i >= 0; i--)
			dp[i] += dp[i + 1];
		vector<int> as(26);
		for (int i = 0; i < n; i++) {
			as[s[i] - 'a'] += dp[i];
		}
		for (auto i : as)
			 cout << i << ' ';
		cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long

int t, n, m;
string s;

signed main() {
	cin >> t;
	while (t--) {
		vector<int> v(26);
		cin >> n >> m >> s;
		for (int i = 0; i < m; i++) {
			int e;
			cin >> e;
			for (int j = 0; j < e; j++) {
				v[s[j]-'a']++;
			}
		}
		for (int j = 0; j < n; j++) {
				v[s[j]-'a']++;
		}
		for (auto x : v) cout << x << ' ';
			cout << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long

int t, n, m;
string s;

signed main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> t;
	while (t--) {
		vector<int> v(26);
		cin >> n >> m >> s;
		for (int i = 0; i < m; i++) {
			int e;
			cin >> e;
			for (int j = 0; j < e; j++) {
				v[s[j]-'a']++;
			}
		}
		for (int j = 0; j < n; j++) {
				v[s[j]-'a']++;
		}
		for (auto x : v) cout << x << ' ';
			cout << endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
#define see(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()

ll ans;
int arr[300009];
int t[200009][30];
vi vr;
void solve()
{
    memset(t,0,sizeof(t));
    int n;  cin>>n;
    int p;  cin>>p;
    string s;
    cin>>s;
    for(int i = 0; i < p; ++i)
        cin>>arr[i];

    for(int i = 0; i < n; ++i){
        t[i+1][s[i]-97]++;
        for(int j = 0; j < 26; ++j){
            t[i+1][j] += t[i][j];
        }
        hsh[s[i]-97]++;
    }

    vi hsh(30,0);
    for(int i = 0; i < p; ++i){
        for(int j = 0; j < 26; ++j)
            hsh[j] += t[arr[i]][j];
    }
    for(int i = 0; i < 26; ++i)
        cout<<hsh[i]<<' ';
    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testc;  cin>>testc;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

/*
Sun 04 Oct 2020 09:48:47 AM IST
*	astrainL3gi0N
*/


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
#define see(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()

ll ans;
int arr[300009];
int t[200009][30];
vi vr;
void solve()
{
    memset(t,0,sizeof(t));
    int n;  cin>>n;
    int p;  cin>>p;
    string s;
    cin>>s;
    for(int i = 0; i < p; ++i)
        cin>>arr[i];
    vi hsh(30,0);

    for(int i = 0; i < n; ++i){
        t[i+1][s[i]-97]++;
        for(int j = 0; j < 26; ++j){
            t[i+1][j] += t[i][j];
        }
        hsh[s[i]-97]++;
    }

    for(int i = 0; i < p; ++i){
        for(int j = 0; j < 26; ++j)
            hsh[j] += t[arr[i]][j];
    }
    for(int i = 0; i < 26; ++i)
        cout<<hsh[i]<<' ';
    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testc;  cin>>testc;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

/*
Sun 04 Oct 2020 09:48:47 AM IST
*	astrainL3gi0N
*/


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
#define see(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()

ll ans;
int arr[300009];
vi vr;
void solve()
{
    int n;  cin>>n;
    int p;  cin>>p;
    string s;
    cin>>s;
    for(int i = 0; i < p; ++i)
        cin>>arr[i];
    vi hsh(30,0);
    vi ansh(30,0);
    sort(arr,arr+p);
    int nextindx = 0;
    for(int i = 0; i < n; ++i){
        hsh[s[i]-97]++;
        if(nextindx < p && i == arr[nextindx]-1){
            int cnt = 1;
            nextindx++;
            while(nextindx < n && arr[nextindx] == arr[nextindx-1]){
                cnt++;
                nextindx++;
            }
            for(int j = 0; j < 26; ++j)
                ansh[j] += cnt*hsh[j];
        }
    }
    for(int i = 0; i < 26; ++i)
        ansh[i] += hsh[i];

    for(int i = 0; i < 26; ++i)
        cout<<ansh[i]<<' ';
    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testc;  cin>>testc;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

/*
Sun 04 Oct 2020 09:48:47 AM IST
*	astrainL3gi0N
*/


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
#define see(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()

ll ans;
int arr[300009];
int t[200009][30];
vi vr;
void solve()
{
    memset(t,0,sizeof(t));
    int n;  cin>>n;
    int p;  cin>>p;
    string s;
    cin>>s;
    for(int i = 0; i < p; ++i)
        cin>>arr[i];

    for(int i = 0; i < n; ++i){
        t[i+1][s[i]-97]++;
        for(int j = 0; j < 26; ++j){
            t[i+1][j] += t[i][j];
        }
    }

    vi hsh(30,0);
    for(int i = 0; i < p; ++i){
        for(int j = 0; j < 26; ++j)
            hsh[j] += t[arr[i]][j];
    }
    for(int i = 0; i < n; ++i)
        hsh[s[i]-97]++;
    for(int i = 0; i < 26; ++i)
        cout<<hsh[i]<<' ';
    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testc;  cin>>testc;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

/*
Sun 04 Oct 2020 09:48:47 AM IST
*	astrainL3gi0N
*/


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
#define see(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()

ll ans;
int arr[300009];
void solve()
{
    vi vr;
    int n;  cin>>n;
    int p;  cin>>p;
    string s;
    cin>>s;
    vi cntarr(n+100,0);
    for(int i = 0; i < p; ++i){
        int k;  cin>>k;
        cntarr[k]++;
        vr.push_back(k);
    }
    vi hsh(30,0);
    vi ansh(30,0);
    sort(all(vr));
    unique(all(vr));
    auto itr = vr.begin();
    int nump = *itr;
    for(int i = 0; i < n; ++i){
        hsh[s[i]-97]++;
        if(itr != vr.end() && i == nump-1){
            itr++;

            for(int j = 0; j < 26; ++j)
                ansh[j] += cntarr[nump]*hsh[j];
            if(itr != vr.end())
                nump = *itr;
        }
    }
    for(int i = 0; i < 26; ++i)
        ansh[i] += hsh[i];

    for(int i = 0; i < 26; ++i)
        cout<<ansh[i]<<' ';
    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testc;  cin>>testc;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

/*
Sun 04 Oct 2020 09:48:47 AM IST
*	astrainL3gi0N
*/


#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long int ll;
#define see(x)	cout<<(#x)<<"=>"<<x<<'\n';
#define len(a) (int)(a).size()
#define all(x) x.begin(),x.end()

ll ans;
int arr[300009];
vi vr;
void solve()
{
    int n;  cin>>n;
    int p;  cin>>p;
    string s;
    cin>>s;
    for(int i = 0; i < p; ++i)
        cin>>arr[i];
    vi hsh(30,0);
    vi ansh(30,0);
    sort(arr,arr+p);
    int nextindx = 0;
    for(int i = 0; i < n; ++i){
        hsh[s[i]-97]++;
        if(nextindx < p && i == arr[nextindx]-1){
            int cnt = 0;
            nextindx++;
            while(nextindx < n){
                cnt++;
                if(arr[nextindx] == arr[nextindx-1])
                nextindx++;
                else
                    break;
            }
            for(int j = 0; j < 26; ++j)
                ansh[j] += cnt*hsh[j];
        }
    }
    for(int i = 0; i < 26; ++i)
        ansh[i] += hsh[i];

    for(int i = 0; i < 26; ++i)
        cout<<ansh[i]<<' ';
    cout<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int testc;  cin>>testc;
    for(int t = 0; t < testc; ++t){
        solve();
    }
    return 0;
}

/*
Sun 04 Oct 2020 09:48:47 AM IST
*	astrainL3gi0N
*/


#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n,m;
	cin>>n>>m;
	string str;
	cin>>str;
	int pref[n+2];
	map<char,int> mp; char ch='a';
	for(int i=1;i<=26;i++,mp[ch++]=0);
	memset(pref,0,sizeof(pref));
	for(int i=0,x;i<m;i++)
	{
		cin>>x;
		pref[x-1]++;
	}
	for(int i=n-1;i>=0;i--)
	{
		pref[i-1]+=pref[i];
	}
	for(int i=0;i<n;i++)
	{
		mp[str[i]]+=pref[i];
		mp[str[i]]++;
	}
	for(auto m:mp)
	{
		cout<<m.second<<" ";
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve(),cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n,m;
	cin>>n>>m;
	string str;
	cin>>str;
	vector<int> pf(n,0),ans(26,0);
	for(int i=0;i<m;i++)
	{
		int x; cin>>x;
		pf[x-1]++;
	}
	for(int i=n-1;i>=0;i--)
	{
		pf[i-1]+=pf[i];
	}
	for(int i=0;i<n;i++)
	{
		ans[str[i]-'a']+=pf[i];
		ans[str[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		cout<<ans[i]<<" ";
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve(),cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n,m;
	cin>>n>>m;
	string str;
	cin>>str;
	vector<int> vec(m);
	for(auto &v:vec)
	{
		cin>>v;
	}
	map<char,int> mp; char ch='a';
	for(int i=1;i<=26;i++)
	{
		mp[ch++]=0;
	}vec.push_back(str.length());
	for(int i=0;i<vec.size();i++)
	{
		for(int j=0;j<vec[i];j++)
		{
			mp[str[j]]++;
		}
	}
	for(auto m:mp)
	{
		cout<<m.second<<" ";
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve(),cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n,m;
	cin>>n>>m;
	string str;
	cin>>str;
	vector<int> pf(n+2,0),ans(27,0);
	for(int i=0;i<m;i++)
	{
		int x; cin>>x;
		pf[x-1]++;
	}
	for(int i=n-1;i>=0;i--)
	{
		pf[i-1]+=pf[i];
	}
	for(int i=0;i<n;i++)
	{
		ans[str[i]-'a']+=pf[i];
		ans[str[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		cout<<ans[i]<<" ";
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve(),cout<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n,m;
	cin>>n>>m;
	string str;
	cin>>str;
	vector<int> pf(n,0),ans(27,0);
	for(int i=0;i<m;i++)
	{
		int x; cin>>x;
		pf[x-1]++;
	}
	for(int i=n-1;i>=0;i--)
	{
		pf[i-1]+=pf[i];
	}
	for(int i=0;i<n;i++)
	{
		ans[str[i]-'a']+=pf[i];
		ans[str[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		cout<<ans[i]<<" ";
	}
}
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		solve(),cout<<endl;
	}
	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

	int t;
	cin >> t;
	while(t--){

		int letter[26] = {0};
		string str;
		int m,n;
		cin >> n >> m;
		cin >> str;
		vector<int> p(m+1);
		for(int i =0;i<m;i++){
			cin >> p[i];
		}
		/*p[m] = str.length();
		for(int i =0;i<m+1;i++){
			for(int j=0;j<p[i];j++){

				letter[str[j]-'a']++;
			}
		}
		for(int i=0;i<26;i++){
			cout << letter[i] <<" ";
		}
		cout << endl;
		*/
	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

	int t;
	cin >> t;
	while(t--){

		int letter[26] = {0};
		string str;
		int m,n;
		cin >> n >> m;
		cin >> str;
		vector<int> p(m+1);
		for(int i =0;i<m;i++){
			cin >> p[i];
		}
		p[m] = str.length();
		for(int i =0;i<m+1;i++){
			for(int j=0;j<p[i];j++){

				letter[str[j]-'a']++;
			}
		}
		for(int i=0;i<26;i++){
			cout << letter[i] <<" ";
		}
		cout << endl;

	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

	int t;
	cin >> t;
	while(t--){

		int letter[26] = {0};
		string str;
		int m,n;
		cin >> n >> m;
		cin >> str;
		vector<int> p(m+1);
		for(int i =0;i<m;i++){
			cin >> p[i];
		}
		p[m] = str.length();
		for(int i =0;i<m+1;i++){
			for(int j=0;j<p[i];j++){

				letter[str[j]-97]++;
			}
		}
		for(int i=0;i<26;i++){
			cout << letter[i] <<" ";
		}
		cout << endl;

	}

	return 0;
}


#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){

	int t;
	cin >> t;
	while(t--){

		int letter[26] = {0};
		string str;
		int m,n;
		cin >> n >> m;
		cin >> str;
		vector<int> p(m+1);
		for(int i =0;i<m;i++){
			cin >> p[i];
		}

		vector<int> cnt(n);
		for(int i=0;i<m;i++){
			cnt[p[i]-1]++;
		}
		cnt[n-1]++;
		for(int i=n-1;i>0;i--){
			cnt[i-1] += cnt[i];
		}
		for(int i=0;i<n;i++){
			letter[str[i]-'a'] += cnt[i];
		}

		//Nao otimo
		/*for(int i =0;i<m+1;i++){
			for(int j=0;j<p[i];j++){

				letter[str[j]-'a']++;
			}
		}*/

		for(int i=0;i<26;i++){
			cout << letter[i] <<" ";
		}
		cout << endl;

	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef int ll;
ll b, t,  c, m, n, a[222222], ko[222222],p;
string s;
map< int, int> mp;
int main()
{
    freopen("in.in","r",stdin);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;

        memset(ko, 0, sizeof(ko)); mp.clear();
        for( char  ii =  'a'; ii <= 'z'; ii++ ) mp[ii-'a']++;

        for ( int i = 1; i <= m;  i++)  cin >> ko[i];
        ko[m+1] = n;
        for ( int j = 1; j <= m+1; j++){
           int p = ko[j];
           for ( int g = 0; g <= p-1; g++ ) mp[s[g]-'a']++;
        }

       for ( auto t:mp) cout << t.second - 1 <<" " ;
       cout << endl;

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll  i, j, k, x, pos, n, m, t;

int main() {

    cin>>t;
    while(t--)
    {
        cin >> n >> m;
        string s; cin >> s  ;
        vector < int > v;
        for(i = 0; i < m; i++){ cin >> k; v.push_back(k);}
        vector < ll > ans(26,0);

        sort(v.begin(),v.end());

        for(i = 1;i <= n;i++){
            pos = (lower_bound (v.begin(), v.end(), i)- v.begin());
            x = m - pos + 1;
            ans[s[i-1]-'a'] += x;
        }
        for(i = 0; i < 26; i++)  cout << ans[i] <<" ";  cout<<endl;
    }
}


#include <bits/stdc++.h>

using namespace std;
typedef int ll;
ll b, t,  c, m, n, a[200001], ko[200001],p;
string s;
map< int, int> mp;
int main()
{
//freopen("in.in","r",stdin);
    ios_base::sync_with_stdio(0);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;

        for( char  ii =  'a'; ii <= 'z'; ii++ ) mp[ii-'a']++;

        for ( int i = 1; i <= m;  i++)  cin >> ko[i];
        ko[m+1] = n;

        for ( int j = 1; j <= m+1; j++){
           int p = ko[j];
           for ( int g = 0; g <= p-1; g++ ) mp[s[g]-'a']++;
        }

       for ( auto t:mp) cout << t.second - 1 <<" " ;
       cout << endl;

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef int ll;
ll b, t,  c, m, n, a[22222], ko[22222],p;
string s;
map< int, int> mp;
int main()
{
    //freopen("in.in","r",stdin);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;

        memset(ko, 0, sizeof(ko)); mp.clear();
        for( char  ii =  'a'; ii <= 'z'; ii++ )
            mp[ii-'a']++;

        for ( int i = 1; i <= m;  i++)  cin >> ko[i];
        ko[m+1] = n;
        for ( int j = 1; j <= m+1; j++){
           int p = ko[j];
            for ( int g = 0; g <= p-1; g++ ) mp[s[g]-'a']++;
        }

       for ( auto t:mp) cout << t.second - 1 <<" " ;
       cout << endl;

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef int ll;
ll b, t,  c, m, n, a[222222], ko[222222],p;
string s;
map< int, int> mp;
int main()
{
    //freopen("in.in","r",stdin);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;

        memset(ko, 0, sizeof(ko)); mp.clear();
        for( char  ii =  'a'; ii <= 'z'; ii++ ) mp[ii-'a']++;

        for ( int i = 1; i <= m;  i++)  cin >> ko[i];
        ko[m+1] = n;
        for ( int j = 1; j <= m+1; j++){
           int p = ko[j];
           for ( int g = 0; g <= p-1; g++ ) mp[s[g]-'a']++;
        }

       for ( auto t:mp) cout << t.second - 1 <<" " ;
       cout << endl;

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef int ll;
ll b, t,  c, m, n, a[22222], ko[22222],p;
string s;
map< int, int> mp;
int main()
{
    //freopen("in.in","r",stdin);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;

        memset(ko, 0, sizeof(ko)); mp.clear();
        for( char  ii =  'a'; ii < 'z'; ii++ )
            mp[ii-'a']++;

        for ( int i = 1; i <= m;  i++)  cin >> ko[i]; ko[m+1] = n;
        for ( int j = 1; j <= m+1; j++){
           int p = ko[j];
        for ( int g = 0; g <= p-1; g++ ){
            mp[s[g]-'a']++;
        }

        }

for ( auto t:mp) cout << t.second -1 <<" "; cout << endl;

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef int ll;
ll b, t,  c, m, n, a[22222], ko[22222],p;
string s;
map< int, int> mp;
int main()
{
    freopen("in.in","r",stdin);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;

        memset(ko, 0, sizeof(ko)); mp.clear();
        for( char  ii =  'a'; ii < 'z'; ii++ )
            mp[ii-'a']++;

        for ( int i = 1; i <= m;  i++)  cin >> ko[i]; ko[m+1] = n;
        for ( int j = 1; j <= m+1; j++){
           int p = ko[j];
        for ( int g = 0; g <= p-1; g++ ){
            mp[s[g]-'a']++;
        }

        }

for ( auto t:mp) cout << t.second -1 <<" "; cout << endl;

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll  i, j, k, x, pos, n, m, t;
vector < int > v;
int main() {
    cin>>t;
    while(t--)
    {
        cin >> n >> m;
        string s; cin >> s  ;
        for(i = 0; i < m; i++){ cin >> k; v.push_back(k);}
        vector < ll > ans(26,0);

        sort(v.begin(),v.end());

        for(i = 1;i <= n;i++){
            pos = (lower_bound (v.begin(), v.end(), i)- v.begin());
            x = m - pos + 1;
            ans[s[i-1]-'a'] += x;
        }
        for(i = 0; i < 26; i++)  cout << ans[i] <<" ";  cout<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
int t, m, n, ko;
string s;
int main()
{
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;
        vector < int > pre(n);
        for ( int i = 0; i < m;  i++){ cin >> ko; pre[ko-1]++;}
        for ( int i = n-2; i >= 0; i--) pre[i]+=pre[i+1];
        vector < int > ans(26, 0);
        for ( int i = 0; i < n; i++) ans[s[i]-'a']+=(pre[i]+1);
        for ( int i = 0; i < 26; i++) cout << ans[i] <<" "; cout << endl;

    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int t, m, n, ko;
string s;
int main()
{
    freopen("input.txt","r",stdin);
    cin >> t;
    while ( t--){
        cin >> n >> m; cin >> s;
        vector < int > pre(n);
        for ( int i = 0; i < m;  i++){ cin >> ko; pre[ko-1]++;}
        for ( int i = n-2; i >= 0; i--) pre[i]+=pre[i+1];
        vector < int > ans(26, 0);
        for ( int i = 0; i < n; i++) ans[s[i]-'a']+=(pre[i]+1);
        for ( int i = 0; i < 26; i++) cout << ans[i] <<" "; cout << endl;

    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int a[m];
        rep(i,m)
            cin>>a[i];
        int ans[26];
        memset(ans,0,sizeof(ans));
        for(int i = 0;i<m;i++)
        {
            ans[0]++;
            if (a[i]-1 != 25)
                ans[a[i]]--;
        }
        int r = s.size();
        ans[0]++;
        if((r-1) != 25)
            ans[r]--;
        for (int i = 1; i < 26; i++)
            ans[i] += ans[i - 1];

        int asli[26];
        memset(asli,0,sizeof(asli));

        for(int i =0;i<s.size();i++)
        {
           asli[s[i]-'0'-49] += ans[i];
        }
        for(int i =0;i<26;i++)
            cout<<asli[i]<<" ";
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int a[m];
        rep(i,m)
            cin>>a[i];
        int ans[26];
        memset(ans,0,sizeof(ans));
        for(int i = 0;i<m;i++)
        {
            ans[0]++;
            if (a[i]-1 != 25)
                ans[a[i]]--;
        }
        int r = s.size();
        ans[0]++;
        if((r-1) != 25)
            ans[r]--;
        for (int i = 1; i < 26; i++)
            ans[i] += ans[i - 1];

        int asli[26];
        memset(asli,0,sizeof(asli));

        for(int i =0;i<s.size();i++)
        {
           asli[s[i]-'0'-49] += ans[i];
        }
        for(int i =0;i<26;i++)
            cout<<asli[i]<<" ";

        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int a[m];
        rep(i,m)
            cin>>a[i];

        int ans[26]={0};
        for(int i = 0;i<m;i++)
        {
            ans[0]++;
            if (a[i]-1 != 25)
                ans[a[i]]--;
        }
        int r = s.size();
        ans[0]++;
        if((r-1) != 25)
            ans[r]--;
        for (int i = 1; i < 26; i++)
            ans[i] += ans[i - 1];
        int asli[26] = {0};
        for(int i =0;i<r;i++)
        {
           asli[s[i]-'0'-49] += ans[i];
        }
        for(int i =0;i<26;i++)
        {
            cout<<asli[i]<<" ";
        }
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int a[m];
        rep(i,m)
            cin>>a[i];

        int ans[26]={0};
        for(int i = 0;i<m;i++)
        {
            ans[0]++;
            if (a[i]-1 != 25)
                ans[a[i]]--;
        }

        int r = s.size();

        ans[0]++;
        if((r-1) != 25)
            ans[r]--;

        for(int i = 1; i < 26; i++)
            ans[i] += ans[i - 1];

        int asli[26] = {0};
        for(int i =0;i<r;i++)
        {
           asli[((int)s[i])-97] += ans[i];
        }
        for(int i =0;i<26;i++)
        {
            cout<<asli[i]<<" ";
        }
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int r = s.size();
        int a[m] = {0};
        int ans[r]={0};

        for(int i=0;i<m;i++)
            cin>>a[i];

        for(int i = 0;i<m;i++)
        {
            ans[0]++;
            if (a[i]-1 != (r-1))
                ans[a[i]]--;
        }
        ans[0]++;

        for(int i = 1; i < r; i++)
            ans[i] += ans[i - 1];

        int asli[26] = {0};
        for(int i =0;i<r;i++)
        {
           asli[((int)s[i])-97] += ans[i];
        }
        for(int i =0;i<26;i++)
        {
            cout<<asli[i]<<" ";
        }
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int a[m];
        for(int i=0;i<m;i++)
            cin>>a[i];

        int ans[26]={0};
        for(int i = 0;i<m;i++)
        {
            ans[0]++;
            if (a[i]-1 != 25)
                ans[a[i]]--;
        }

        int r = s.size();

        ans[0]++;
        if((r-1) != 25)
            ans[r]--;

        for(int i = 1; i < 26; i++)
            ans[i] += ans[i - 1];

        int asli[26] = {0};
        for(int i =0;i<r;i++)
        {
           asli[((int)s[i])-97] += ans[i];
        }
        for(int i =0;i<26;i++)
        {
            cout<<asli[i]<<" ";
        }
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>

#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define repD(i,n) for(int i=n-1;i>=0;i--)

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        string s;
        cin>>s;
        int a[m];
        rep(i,m)
            cin>>a[i];
        int ans[26];
        memset(ans,0,sizeof(ans));
        for(int i=0;i<m;i++)
        {
            for(int j=0;j<a[i];j++)
            {
                ans[s[j]-'0'-49]++;
            }
        }
        for(int i=0;i<s.size();i++)
        {
            ans[s[i]-'0'-49]++;
        }
        for(int i=0;i<26;i++)
        {
            cout<<ans[i]<<" ";
        }
        cout<<'\n';
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){

    ll T;
    cin >> T;

    while(T--) {

        ll n,m;
        vector<int> arr(26, 0);
        string str;

        cin >> n >> m;
        vector<ll> p(m);
        cin >> str;

        ll cur;
        for(ll i=0; i<m; i++){
            cin >> p[i];
        }

        for(ll i=0; i<n; i++){

            arr[ str[i] - 'a']++;

            for(ll j=0; j<m; j++) {
                if( p[j]-1 == i ) {
                    i = -1;
                    p[j] = -1;
                    break;
                }
            }

        }

        for(int i=0; i<26; i++)
            cout << arr[i] << " ";

        cout<<endl;
    }

}


#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){

    ll T;
    cin >> T;

    while(T--) {

        ll n,m;
        vector<int> arr(26, 0);
        string str;

        set<ll> s;

        vector<ll> p(m);

        cin >> n >> m;
        cin >> str;

        ll cur;
        for(ll i=0; i<m; i++){
            //cin >> cur;
            cin >> p[i];
            //s.insert(cur-1);
        }

        for(ll i=0; i<n; i++){

            arr[ tolower(str[i]) - 'a']++;

            // if( s.find(i) != s.end() ) {
            //     i=-1;
            //     s.erase(s.begin());
            // }

            for(ll j=0; j<m; j++) {
                if( p[j]-1 == i ) {
                    i = -1;
                    p[j] = -1;
                    break;
                }
            }

        }

        for(int i=0; i<26; i++)
            cout << arr[i] << " ";

        cout<<endl;
    }

}


#include<bits/stdc++.h>
#define ll long long
#define vi vector<ll>
using namespace std;

int main(){

    ll T;
    cin >> T;

    while(T--) {

        int n, m;
        cin >> n >> m;

        vi cnt(26,0);
        vi v(m);
        string s;
        cin >> s;

        int i,j;
        for(i=0; i<m ;i++)
        cin >> v[i];

        sort(v.begin(),v.end());

        int p = 0;
        for(i=0 ; i < m ; i++)
        {
            for(j=p ; j<v[i] ; j++)
            {
                cnt[(int)s[j]-97]+=(m-i);
            }
            p=v[i];
        }

        for(i=0; i<n ;i++)  cnt[(int)s[i]-97]++;

        for(i=0; i <26 ;i++) cout << cnt[i] << " ";

        cout << endl;

    }

}


#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){

    ll T;
    cin >> T;

    while(T--) {

        ll n,m;
        vector<int> arr(26, 0);
        string str;

        set<ll> s;

        vector<ll> p(m);

        cin >> n >> m;
        cin >> str;

        ll cur;
        for(ll i=0; i<m; i++){
            cin >> p[i];
        }

        for(ll i=0; i<n; i++){

            arr[ str[i] - 'a']++;

            for(ll j=0; j<m; j++) {
                if( p[j]-1 == i ) {
                    i = -1;
                    p[j] = -1;
                    break;
                }
            }

        }

        for(int i=0; i<26; i++)
            cout << arr[i] << " ";

        cout<<endl;
    }

}


#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){

    ll T;
    cin >> T;

    while(T--) {

        ll n,m;
        vector<int> arr(26, 0);
        string str;

        cin >> n >> m;
        vector<ll> p(m);
        cin >> str;

        unordered_map<ll, int> mp;

        for(ll i=0; i<m; i++){
            cin >> p[i];
            mp[p[i]-1]++;
        }

        for(ll i=0; i<n; i++){

            arr[ str[i] - 'a']++;

            // for(ll j=0; j<m; j++) {
            //     if( p[j]-1 == i ) {
            //         i = -1;
            //         p[j] = -1;
            //         break;
            //     }
            // }

            if( mp.find(i) != mp.end() ) {
                mp[ i ]--;

                if(mp[i] <= 0)
                    mp.erase(i);

                i = -1;
            }

        }

        for(int i=0; i<26; i++)
            cout << arr[i] << " ";

        cout<<endl;
    }

}


#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){

    ll T;
    cin >> T;

    while(T--) {

        ll n,m;
        vector<int> arr(26, 0);
        string str;

        set<ll> s;

        vector<ll> p(m);

        cin >> n >> m;
        cin >> str;

        ll cur;
        for(ll i=0; i<m; i++){
            cin >> p[i];
        }

        for(ll i=0; i<n; i++){

            arr[ tolower(str[i]) - 'a']++;

            for(ll j=0; j<m; j++) {
                if( p[j]-1 == i ) {
                    i = -1;
                    p[j] = -1;
                }
            }

        }

        for(int i=0; i<26; i++)
            cout << arr[i] << " ";

        cout<<endl;
    }

}


#include<iostream>
using namespace std;
int main()
{
	int t;cin>>t;
	while(t--)
	{
		int n,m,a[26]={0},p;string s;cin>>n>>m>>s;
		for(int i=0;i<m;++i)
		{
			cin>>p;
			for(int j=0;j<p;++j)
			{
				a[s[j]-'a']++;
			}
		 }
		 for(int i=0;i<n;++i)
		 a[s[i]-'a']++;
		 for(int i=0;i<26;++i)
		 cout<<a[i]<<' ';
		 cout<<endl;
	}
 }


#include<bits/stdc++.h>
using namespace std;
char s[200005];
int main()
{
	int t;cin>>t;
	while(t--)
	{
		int n,m,a[26]={0},p;
		scanf("%d %d %s",&n,&m,&s);
		for(int i=0;i<m;++i)
		{
			scanf("%d",&p);
			for(int j=0;j<p;++j)
			{
				a[s[j]-'a']++;
			}
		 }
		 for(int i=0;i<n;++i)
		 a[s[i]-'a']++;
		 for(int i=0;i<26;++i)
		 printf("%d ",a[i]);
		 printf("\n");
	}
 }


#include<bits/stdc++.h>
using namespace std;
int p,pos[200005],num[200005];
char s[200005];
int main()
{
	int t;scanf("%d",&t);
	while(t--)
	{long long sum[28]={0};
		int m,n;scanf("%d%d",&n,&m);
		scanf("%s",s+1);
		memset(pos,0,sizeof(pos));
		memset(num,0,sizeof(num));
		for(int i=1;i<=m;++i)
		{scanf("%d",&p);pos[p]++;
		}pos[n]++;num[n]=pos[n];
		for(int i=n-1;i>=1;--i)
		{
		num[i]+=num[i+1]+pos[i];
		}
		for(int i=1;i<=n;++i)
		{
			sum[s[i]-'a']+=num[i];
		}
		for(int i=0;i<26;++i)
		printf("%lld ",sum[i]);
		printf("\n");
	}
}


#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int t;scanf("%d",&t);
	while(t--)
	{
		int n,m,a[26]={0},p;string s;scanf("%d%d%s",&n,&m,&s);
		for(int i=0;i<m;++i)
		{
			scanf("%d",&p);
			for(int j=0;j<p;++j)
			{
				a[s[j]-'a']++;
			}
		 }
		 for(int i=0;i<n;++i)
		 a[s[i]-'a']++;
		 for(int i=0;i<26;++i)
		 printf("%d ",a[i]);
		 printf("\n");
	}
 }


#include<bits/stdc++.h>

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0 , 0 , -1 , 1 } ;
int dy4[] = { -1 , 1 , 0 , 0 } ;
bool valid( int r , int c , int x , int y ){
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ; return 0 ;}

using namespace std;
lli ans[1000000];
int main ()
{
    int t;
    cin >> t;
    for(int cs=1;cs<=t;cs++)
    {
        int n,m;
        map<char,int>mp;
        cin >> n>> m;
        string s;
        cin >> s;
        s= "#"+s;
        int a[m+2];
        for(int i=1;i<=m;i++)
        {
            cin >> a[i];
            ans[1]++;
            ans[a[i]+1]--;
        }
        ans[1]++;
        ans[n+1]--;
        for(int i=1;i<=n;i++)
        {
            ans[i]+=ans[i-1];
        }
//        for(int i=1;i<=15;i++)
//            cout << ans[i]<< " ";
//        cout <<endl;
        for(int i=1;i<=n;i++)
        {
            mp[s[i]]+=ans[i];
        }
        for(char ch='a';ch<='z';ch++)
            cout << mp[ch]<< " ";
        cout <<endl;
        mem(ans,0);
    }

    return 0;
}


#include<bits/stdc++.h>

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0 , 0 , -1 , 1 } ;
int dy4[] = { -1 , 1 , 0 , 0 } ;
bool valid( int r , int c , int x , int y ){
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ; return 0 ;}

using namespace std;
lli ans[1000000];
int main ()
{
    int t;
    sci(t);
    for(int cs=1;cs<=t;cs++)
    {
        lli n,m;
        map<char,lli>mp;
        scll(n,m);
        string s;
        cin >> s;
       // s= "#"+s;
        lli a[m+2];
        for(int i=1;i<=m;i++)
        {
            scl(a[i]);
            ans[1]++;
            ans[a[i]+1]--;
        }
        ans[1]++;
        ans[n+1]--;
        for(int i=1;i<=n;i++)
        {
            ans[i]+=ans[i-1];
        }
//        for(int i=1;i<=15;i++)
//            cout << ans[i]<< " ";
//        cout <<endl;
        for(int i=0;i<n;i++)
        {
            mp[s[i]]+=ans[i+1];
        }
        for(char ch='a';ch<='z';ch++)
            pf("%lld ",mp[ch]);
        pf("\n");
        mem(ans,0);
    }

    return 0;
}


#include<bits/stdc++.h>

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0 , 0 , -1 , 1 } ;
int dy4[] = { -1 , 1 , 0 , 0 } ;
bool valid( int r , int c , int x , int y ){
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ; return 0 ;}

using namespace std;

int main ()
{
    int t;
    sci(t);
    for(int cs=1;cs<=t;cs++)
    {
        lli n,m;
        scll(n,m);
        lli ans[n+2];
        lli mp[30];
        mem(ans,0);
        mem(mp,0);
        string s;
        cin >> s;
        lli a[m+2];
        mem(a,0);
        for(int i=1;i<=m;i++)
        {
            scl(a[i]);
            ans[1]++;
            ans[a[i]+1]--;
        }
        ans[1]++;
        ans[n+1]--;
        for(int i=1;i<=n;i++)
        {
            ans[i]+=ans[i-1];
        }
//        for(int i=1;i<=15;i++)
//            cout << ans[i]<< " ";
//        cout <<endl;
        for(int i=0;i<n;i++)
        {
            int x= (int)s[i]-97;
           // cout << x<<endl;
            mp[x]+=ans[i+1];
        }
        for(int ch=0;ch<26;ch++)
            pf("%lld ",mp[ch]);
        pf("\n");
    }

    return 0;
}


#include<bits/stdc++.h>

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0 , 0 , -1 , 1 } ;
int dy4[] = { -1 , 1 , 0 , 0 } ;
bool valid( int r , int c , int x , int y ){
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ; return 0 ;}

using namespace std;
lli ans[1000000];
int main ()
{
    int t;
    cin >> t;
    for(int cs=1;cs<=t;cs++)
    {
        int n,m;
        map<char,int>mp;
        cin >> n>> m;
        string s;
        cin >> s;
       // s= "#"+s;
        int a[m+2];
        for(int i=1;i<=m;i++)
        {
            cin >> a[i];
            ans[1]++;
            ans[a[i]+1]--;
        }
        ans[1]++;
        ans[n+1]--;
        for(int i=1;i<=n;i++)
        {
            ans[i]+=ans[i-1];
        }
//        for(int i=1;i<=15;i++)
//            cout << ans[i]<< " ";
//        cout <<endl;
        for(int i=0;i<n;i++)
        {
            mp[s[i]]+=ans[i+1];
        }
        for(char ch='a';ch<='z';ch++)
            cout << mp[ch]<< " ";
        cout <<endl;
        mem(ans,0);
    }

    return 0;
}


#include<bits/stdc++.h>

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0 , 0 , -1 , 1 } ;
int dy4[] = { -1 , 1 , 0 , 0 } ;
bool valid( int r , int c , int x , int y ){
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ; return 0 ;}

using namespace std;
lli ans[1000000];
lli mp[1000000];
int main ()
{
    int t;
    sci(t);
    for(int cs=1;cs<=t;cs++)
    {
        lli n,m;

        scll(n,m);

        string s;
        cin >> s;
       // s= "#"+s;
        lli a[m+2];
        for(int i=1;i<=m;i++)
        {
            scl(a[i]);
            ans[1]++;
            ans[a[i]+1]--;
        }
        ans[1]++;
        ans[n+1]--;
        for(int i=1;i<=n;i++)
        {
            ans[i]+=ans[i-1];
        }
//        for(int i=1;i<=15;i++)
//            cout << ans[i]<< " ";
//        cout <<endl;
        for(int i=0;i<n;i++)
        {
            int x= (int)s[i]-97;
           // cout << x<<endl;
            mp[x]+=ans[i+1];
        }
        for(int ch=0;ch<26;ch++)
            pf("%lld ",mp[ch]);
        pf("\n");
        mem(ans,0);
        mem(mp,0);
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll t;
	cin>>t;
	while(t--){
	ll n,m;
	cin>>n>>m;
	string s,s1;
	cin>>s;
	s1=s;
	ll a[m];
	vector<ll> v(26,0);
	for(ll i=0;i<m;i++){
		cin>>a[i];
	}
	for(ll i=0;i<m;i++)
	{
		s1+=s.substr(0,a[i]);
	}
	//cout<<s1<<endl;
	for(int i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
   }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll t;
	cin>>t;
	vector<ll> v1;
	while(t--){
	ll n,m;
	cin>>n>>m;
	vector<ll> v(26,0);
	string s;
	string s1="";
	cin>>s;

	for(ll i=0;i<m;i++){
		ll x;
		cin>>x;
		v1.push_back(x);
	}
	for(ll i=0;i<m;i++)
	{
		s1+=s.substr(0,v1[i]);
	}
	s1+=s;
	//cout<<s1<<endl;
	for(ll i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(ll i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
	v.clear();
	v1.clear();
   }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int t;
	cin>>t;
	while(t--){
	int n,m;
	cin>>n>>m;
	vector<int> v1;
	string s,s1;
	cin>>s;
	s1=s;
	vector<int> v(26,0);
	for(int i=0;i<m;i++){
		int x;
		cin>>x;
		v1.push_back(x);
	}
	for(int i=0;i<m;i++)
	{
		s1+=s.substr(0,v1[i]);
	}
	//cout<<s1<<endl;
	for(int i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
   }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int t;
	cin>>t;
	while(t--){
	int n,m;
	cin>>n>>m;
	vector<int> v1;
	string s,s1;
	cin>>s;
	vector<int> v(26,0);
	for(int i=0;i<m;i++){
		int x;
		cin>>x;
		v1.push_back(x);
	}
	for(int i=0;i<m;i++)
	{
		s1+=s.substr(0,v1[i]);
	}
	//cout<<s1<<endl;
	for(int i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
   }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll t;
	cin>>t;
	while(t--){
	ll n,m;
	cin>>n>>m;
	vector<ll> v1;
	string s,s1;
	cin>>s;
	s1=s;
	vector<ll> v(26,0);
	for(ll i=0;i<m;i++){
		ll x;
		cin>>x;
		v1.push_back(x);
	}
	for(ll i=0;i<m;i++)
	{
		s1+=s.substr(0,v1[i]);
	}
	//cout<<s1<<endl;
	for(int i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
   }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int t;
	cin>>t;
	vector<int> v1;
	while(t--){
	int n,m;
	cin>>n>>m;
	vector<int> v(26,0);
	string s;
	string s1="";
	cin>>s;

	for(int i=0;i<m;i++){
		int x;
		cin>>x;
		v1.push_back(x);
	}
	for(int i=0;i<m;i++)
	{
		s1+=s.substr(0,v1[i]);
	}
	s1+=s;
	//cout<<s1<<endl;
	for(int i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
	v.clear();
	v1.clear();
   }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	int t;
	cin>>t;
	vector<int> v(26,0);
	vector<int> v1;
	while(t--){
	int n,m;
	cin>>n>>m;
	string s;
	string s1="";
	cin>>s;

	for(int i=0;i<m;i++){
		int x;
		cin>>x;
		v1.push_back(x);
	}
	for(int i=0;i<m;i++)
	{
		s1+=s.substr(0,v1[i]);
	}
	s1+=s;
	//cout<<s1<<endl;
	for(int i=0;i<s1.length();i++)
	{
		v[s1[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	cout<<v[i]<<" ";
	cout<<endl;
	v.clear();
	v1.clear();
   }
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()

ll power(ll x,ll y,ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
ll ans[30],tot[200005];
int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	cin >> t;
	while(t--)
	{
		cin >> n >> m;
		string s;
		cin >> s;

		for(i=0;i<=n;i++)
			tot[i]=0;

		for(i=0;i<26;i++)
			ans[i]=0;

		for(i=1;i<=m;i++)
		{
			cin >> x;
			tot[0]++;
			tot[x]--;
		}

		for(i=1;i<n;i++)
			tot[i]+=tot[i-1];
		for(i=0;i<n;i++)
			ans[s[i]-'a']+=tot[i],ans[s[i]-'a']++;
		for(i=0;i<26;i++)
			cout<<ans[i]<<" ";
		cout<<endl;
	}
}


#include <bits/stdc++.h>
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
//#define N 6
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <math.h>
#define mode 1000000007
#include <cstring>
#include <bitset>
#include <set>

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t, n, m;
	cin >> t;

	string s;

	vector<char> a;
	map<ll, ll> map;

	while (t--) {

		a.clear();
		map.clear();

		cin >> n >> m;

		cin >> s;

		ll l = s.length();
		s = '#' + s;

		ll p[m];
		for (ll i = 0; i < m; i++) {
			cin >> p[i];
		}

		ll j = 1;
		ll k = 0;

		while (j <= l) {
			a.push_back(s[j]);
			if (j == p[k]) {
				j = 1;
				k++;
			} else {
				j++;
			}
		}

		for (ll i = 0; i < a.size(); i++) {
			map[a[i]]++;
		}

		for (ll i = 97; i <= 122; i++) {
			if (map.count(i)) {
				cout << map[i] << " ";
			} else {
				cout << 0 << " ";
			}
		}
		printf("\n");
	}
}


#include <bits/stdc++.h>
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
//#define N 6
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <math.h>
#define mode 1000000007
#include <cstring>
#include <bitset>
#include <set>

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t;
	cin >> t;

	while (t--) {

		ll n, m;
		cin >> n >> m;

		string s;
		cin >> s;

		ll l = s.length();
		s = '#' + s;

		vector<ll> p(m);
		for (ll i = 0; i < m; i++) {
			cin >> p[i];
		}

		vector<char> a;

		ll j = 1;
		ll k = 0;
		vector<ll>::iterator it;

		while (j <= l) {
			a.push_back(s[j]);
			if (j == p[k]) {
//				it = p.begin();
//				p.erase(it);
				j = 1;
				k++;
			} else {
				j++;
			}

//			printf("\n");
//			printf("############");
//			for(ll i=0; i<m; i++){
//				cout << p[i] << " ";
//			}
//			printf("############");
//			printf("\n");
		}

		map<ll, ll> map;
		for (ll i = 0; i < a.size(); i++) {
//			cout << a[i] << " ";
			map[a[i]]++;
		}
//		for (auto p : map) {
//			cout << p.first << ":";
//			cout << p.second << endl;
//		}
//		printf("\n");

		for (ll i = 97; i <= 122; i++) {
			if (map.count(i)) {
				cout << map[i] << " ";
			} else {
				cout << 0 << " ";
			}
		}

//		ll ans[26] = { 0 };

//		printf("\n");
//		map<char, ll> map;
//		for (auto p:map) {
//			cout << p.first << ":";
//			cout << p.second << endl;
//		}
//
		printf("\n");
//		for (auto p : map) {
//			cout << p.first << " ";
//			cout << p.second << endl;
//		}
	}
}


#include <bits/stdc++.h>
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
//#define N 6
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <math.h>
#define mode 1000000007
#include <cstring>
#include <bitset>
#include <set>

ll bs(vector<ll> p, ll i) {

	ll a = p.size();
	ll l = 0;
	ll r = p.size() - 1;
	ll mid;

	while (l <= r) {
		mid = (r + l) / 2;
		if (p[mid] >= i) {
			a = mid;
			r = mid - 1;
//			break;
//		} else if (i < p[mid]) {
//			r = mid - 1;
		} else {
			l = mid + 1;
		}
	}
	return p.size() - a;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t;
	cin >> t;

	while (t--) {

		ll a[26] = { 0 };

		ll n, m;
		cin >> n >> m;

		string s;
		cin >> s;

		for (ll i = 0; i < n; i++) {
			a[s[i] - 'a']++;
		}

		vector<ll> p;
		for (ll i = 0; i < m; i++) {
			ll el;
			cin >> el;
			el--;
			p.push_back(el);
		}

		sort(p.begin(), p.end());

		for (ll i = 0; i < n; i++) {

			ll index = bs(p, i);
			a[s[i] - 'a'] += index;
		}

		for (ll i = 0; i < 26; i++) {
			cout << a[i] << " ";
		}
		printf("\n");
	}
}


#include <bits/stdc++.h>
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
//#define N 6
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <math.h>
#define mode 1000000007
#include <cstring>
#include <bitset>
#include <set>

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t;
	cin >> t;

	while (t--) {

		ll n, m;
		cin >> n >> m;

		string s;
		cin >> s;

		ll l = s.length();
		s = '#' + s;

		ll p[m];
		for (ll i = 0; i < m; i++) {
			cin >> p[i];
		}

		vector<char> a;
		ll j = 1;
		ll k = 0;

		while (j <= l) {
			a.push_back(s[j]);
			if (j == p[k]) {
				j = 1;
				k++;
			} else {
				j++;
			}
		}

		map<ll, ll> map;
		for (ll i = 0; i < a.size(); i++) {
			map[a[i]]++;
		}

		for (ll i = 97; i <= 122; i++) {
			if (map.count(i)) {
				cout << map[i] << " ";
			} else {
				cout << 0 << " ";
			}
		}
		printf("\n");
	}
}


#include <bits/stdc++.h>
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
//#define N 6
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <math.h>
#define mode 1000000007
#include <cstring>
#include <bitset>
#include <set>

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t;
	cin >> t;

	while (t--) {

		ll ans[26];
		fill_n(ans, 26, 0);

		ll n, m;
		cin >> n >> m;

		string s;
		cin >> s;

		ll p;
		ll num[n];
		fill_n(num, n, 0);

		for (ll i = 0; i < m; i++) {
			cin >> p;
			++num[p - 1];
		}

		num[n - 1] = 1;
		for (ll i = n - 2; i >= 0; i--) {
			num[i] += num[i + 1];
		}

		for (ll i = 0; i < n; i++) {
			ans[s[i] - 'a'] += num[i];
		}

		for (ll i = 0; i < 26; i++) {
			cout << ans[i] << " ";
		}
		printf("\n");
	}
}


#include <bits/stdc++.h>
using namespace std;
#include<string.h>
#include <sstream>
typedef long long int ll;
//#define N 6
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <unordered_map>
#include <map>
//#define N 4
#include <stack>
#include <math.h>
#define mode 1000000007
#include <cstring>
#include <bitset>
#include <set>

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	ll t, n, m;
	cin >> t;

	string s;

	map<ll, ll> map;

	while (t--) {

		map.clear();

		cin >> n >> m;

		cin >> s;

		ll l = s.length();
		s = '#' + s;

		ll p[m];
		for (ll i = 0; i < m; i++) {
			cin >> p[i];
		}

		ll j = 1;
		ll k = 0;

		while (j <= l) {
//			a.push_back(s[j]);
			map[s[j]]++;
			if (j == p[k]) {
				j = 1;
				k++;
			} else {
				j++;
			}
		}

//		for (ll i = 0; i < a.size(); i++) {
//			map[a[i]]++;
//		}

		for (ll i = 97; i <= 122; i++) {
			if (map.count(i)) {
				cout << map[i] << " ";
			} else {
				cout << 0 << " ";
			}
		}
		printf("\n");
	}
}


#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int t;
	cin >> t;
	while (t--) {
		int n, m;
		string s;
		cin >> n >> m >> s;
		vector<int> pref(n);
		for (int i = 0; i < m; ++i) {
			int p;
			cin >> p;
			++pref[p - 1];
		}
		for (int i = n - 1; i > 0; --i) {
			pref[i - 1] += pref[i];
		}
		vector<int> ans(26);
		for (int i = 0; i < n; ++i) {
			ans[s[i] - 'a'] += pref[i];
			++ans[s[i] - 'a'];
		}
		for (int i = 0; i < 26; ++i) {
			cout << ans[i] << " ";
		}
		cout << endl;
	}

	return 0;
}


#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int t,n,m,alpha[100],p[100000],temp,count,s[1000000];
    char b;
    cin>>t;
    for(int j=0;j<t;j++)
    {
       cin>>n>>m;
        memset(alpha,0,sizeof(alpha));
        memset(p,0,sizeof(p));
        memset(s,0,sizeof(s));
       for(int i=0;i<n;i++)
       {
           cin>>b;
           s[i]=int(b);
           s[i]=s[i]-97;
           alpha[s[i]]++;

       }

       for(int i=0;i<m;i++)
       {
           cin>>p[i];
           for(int k=0;k<p[i];k++)
           {
               alpha[s[k]]++;
           }
       }

        for(int i=0;i<26;i++)
        {
            cout<<alpha[i]<<" ";
        }
        cout<<"\n";
        // for(int i=0;i<n;i++)
        // {
        //     cout<<s[i];
        // }
    }
    return 0;
}


#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int t,a,b,c,l,n,m,count[1000000],p[100000],s[100000],r[100000];
char k;
cin>>t;
for(int j=0;j<t;j++)
{
    cin>>n>>m;
    memset(count,0,sizeof(count));
       memset(s,0,sizeof(s));
          memset(p,0,sizeof(p));
             memset(r,0,sizeof(r));

        // cin>>s;
        for(int i=0;i<n;i++)
        {
            cin>>k;
            b=int(k);
            s[b-97]=s[k-'a']+1;
            r[i]=b-97;
        }
        for(int i=0;i<m;i++)
        {
            cin>>p[i];
            count[p[i]-1]=count[p[i]-1]+1;
        }
        for(int i=n-2;i>=0;i--)
        {
            count[i]=count[i]+count[i+1];
        }
        //  for(int i=0;i<n-1;i++)
        // {
        //   cout<<count[i];
        // }
          for(int i=0;i<n;i++)
        {
           s[r[i]]=s[r[i]]+count[i];
        }
        for(int i=0;i<26;i++)
        {
            cout<<s[i]<<" ";
        }
        cout<<"\n";

}
return 0;
}


#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int t,a,b,c,l,n,m,count[1000000],p[100000],s[1000000],r[1000000];
char k;
cin>>t;
for(int j=0;j<t;j++)
{
    cin>>n>>m;
    memset(count,0,sizeof(count));
       memset(s,0,sizeof(s));
          memset(p,0,sizeof(p));
             memset(r,0,sizeof(r));

        // cin>>s;
        for(int i=0;i<n;i++)
        {
            cin>>k;
            b=int(k);
            s[b-97]=s[k-'a']+1;
            r[i]=b-97;
        }
        for(int i=0;i<m;i++)
        {
            cin>>p[i];
            count[p[i]-1]=count[p[i]-1]+1;
        }
        for(int i=n-2;i>=0;i--)
        {
            count[i]=count[i]+count[i+1];
        }
        //  for(int i=0;i<n-1;i++)
        // {
        //   cout<<count[i];
        // }
          for(int i=0;i<n;i++)
        {
           s[r[i]]=s[r[i]]+count[i];
        }
        for(int i=0;i<26;i++)
        {
            cout<<s[i]<<" ";
        }
        cout<<"\n";

}
return 0;
}


#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int t,a,b,c,l,n,m,count[1000000],p[1000000],s[1000000],r[1000000];
char k;
cin>>t;
for(int j=0;j<t;j++)
{
    cin>>n>>m;
    memset(count,0,sizeof(count));
       memset(s,0,sizeof(s));
          memset(p,0,sizeof(p));
             memset(r,0,sizeof(r));

        // cin>>s;
        for(int i=0;i<n;i++)
        {
            cin>>k;
            b=int(k);
            s[b-97]=s[k-'a']+1;
            r[i]=b-97;
        }
        for(int i=0;i<m;i++)
        {
            cin>>p[i];
            count[p[i]-1]=count[p[i]-1]+1;
        }
        for(int i=n-2;i>=0;i--)
        {
            count[i]=count[i]+count[i+1];
        }
        //  for(int i=0;i<n-1;i++)
        // {
        //   cout<<count[i];
        // }
          for(int i=0;i<n;i++)
        {
           s[r[i]]=s[r[i]]+count[i];
        }
        for(int i=0;i<26;i++)
        {
            cout<<s[i]<<" ";
        }
        cout<<"\n";

}
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t,i,slen,mislen;
    cin >> t;
    while(t--)
    {
        cin >> slen >> mislen;
        char str[slen];
        long long mis[mislen];
        long long scount[26]={0};
        cin >> str;
        for(i=0;i<mislen;i++)
            cin>>mis[i];
        sort(mis,mis+i);
        for(i=0;i<mislen;i++)
        {
            scount[str[mis[i]-1]-97]+=(mislen-i);
        }
        for(i=0;i<26;i++)
            cout<<(scount[i]+1)<<" ";
        cout<<endl;
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t,i,slen,mislen,j;
    cin >> t;
    while(t--)
    {
        cin >> slen >> mislen;
        char str[slen+1];
        long long mis[mislen];
        long long scount[26]={0};
        scanf(" %s",str);
        for(i=0;i<slen;i++)
            scount[str[i]-97]++;
        for(i=0;i<mislen;i++)
            cin>>mis[i];
        sort(mis,mis+i);
        for(i=0;i<mislen;i++)
        {
            if(i==0)
            {
                for(j=1;j<=mis[i];j++)
                    scount[str[j-1]-97]+=(mislen-i);
            }
            else if(i>0)
            {
                if(mis[i]!=mis[i-1])
                {
                    scount[str[mis[i]-1]-97]+=(mislen-i);
                    for(j=(mis[i-1]+1);j<mis[i];j++)
                        scount[str[j-1]-97]+=(mislen-i);
                }
            }
        }
        for(i=0;i<26;i++)
            cout<<(scount[i])<<" ";
        cout<<endl;
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t,i,slen,mislen,j;
    cin >> t;
    while(t--)
    {
        cin >> slen >> mislen;
        char str[slen+1];
        long long mis[mislen];
        long long scount[26]={0};
        scanf(" %s",str);
        for(i=0;i<slen;i++)
            scount[str[i]-97]++;
        for(i=0;i<mislen;i++)
            cin>>mis[i];
        sort(mis,mis+i);
        for(i=0;i<mislen;i++)
        {
            scount[str[mis[i]-1]-97]+=(mislen-i);
            if(i>0)
            {
                for(j=(mis[i-1]+1);j<mis[i];j++)
                    scount[str[mis[j]-1]-97]++;
            }
        }
        for(i=0;i<26;i++)
            cout<<(scount[i])<<" ";
        cout<<endl;
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long t,i,slen,mislen;
    cin >> t;
    while(t--)
    {
        cin >> slen >> mislen;
        char str[slen+1];
        long long mis[mislen];
        long long scount[26]={0};
        scanf(" %s",str);
        for(i=0;i<slen;i++)
            scount[str[i]-97]++;
        for(i=0;i<mislen;i++)
            cin>>mis[i];
        sort(mis,mis+i);
        for(i=0;i<mislen;i++)
        {
            scount[str[mis[i]-1]-97]+=(mislen-i);
        }
        for(i=0;i<26;i++)
            cout<<(scount[i])<<" ";
        cout<<endl;
    }
}