#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t > 0) {
    int n;
    int m;
    cin >> n >> m;
    string s;
    cin >> s;
    int h[26] = {0};
    vector<int> v1(26, 0);
    vector<vector<int>> v(s.length(), v1);
    for (int i = 0; i < n; i++) {
      h[(int)s[i] - 97]++;
      for (int j = 0; j < 26; j++) {
        v[i][j] += h[j];
      }
    }
    for (int i = 0; i < m; i++) {
      int k;
      cin >> k;
      for (int i = 0; i < 26; i++) h[i] += v[k - 1][i];
    }
    for (int x : h) {
      cout << x << " ";
    }
    cout << endl;
    t--;
  }
}
