#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef unsigned long long ULL;
const int N = 2e6 + 5;
const int base = 131;
char a[N], b[N];
int q[N], res[N];
ULL hashCodeA[N], hashCodeB[N], p[N];
ULL get(ULL hashCode[], int l, int r)
{
return hashCode[r] - hashCode[l-1] * p[r-l+1];
}
int work(int begin, int r)
{
int l = 1, res = 0;
while (l <= r)
{
int mid = (l + r) >> 1;
if (get(hashCodeA, begin, begin+mid-1) == get(hashCodeB, 1, 1+mid-1))
{
res = mid;
l = mid + 1;
}
else r = mid - 1;
}
return res;
}
int main()
{
int n, m, k;
scanf("%d %d %d", &n, &m, &k);
scanf("%s%s", a+1, b+1);
for (int i = 0; i < k; ++i) scanf("%d", &q[i]);
p[0] = 1;
for (int i = 1; i <= n; ++i)
{
hashCodeA[i] = hashCodeA[i-1] * base + a[i] - 'a' + 1;
p[i] = p[i-1] * base;
}
for (int i = 1; i <= m; ++i) hashCodeB[i] = hashCodeB[i-1] * base + b[i] - 'a' + 1;
for (int i = 1; i <= n; ++i)
{
int prefixSize = work(i, min(m, n-i+1));
res[prefixSize]++;
}
for (int i = 0; i < k; ++i) printf("%d\n", res[q[i]]);
return 0;
}