#include <bits/stdc++.h>
using namespace std;
const long long LINF = LLONG_MAX;
const int INF = INT_MAX;
const int MOD = 998244353;
void solve() {
  int n, m;
  string s;
  cin >> n >> m >> s;
  vector<int> p(m);
  for (auto& v : p) cin >> v;
  vector<long long> ans(26);
  for (auto& v : s) ans[v - 'a']++;
  vector<vector<int>> cnt(n, vector<int>(26));
  cnt[0][s[0] - 'a']++;
  for (int i = 1; i < n; i++) {
    cnt[i] = cnt[i - 1];
    cnt[i][s[i] - 'a']++;
  }
  for (auto& t : p) {
    for (int i = 0; i < 26; i++) {
      ans[i] += cnt[t - 1][i];
    }
  }
  for (auto& v : ans) cout << v << ' ';
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  int t;
  cin >> t;
  while (t--) solve();
}
