#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = 0; i < int(v.size()); ++i) {
    os << v[i];
    if (i != v.size() - 1) {
      os << ", ";
    }
  }
  os << "]\n";
  return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
  os << "[";
  os << p.first;
  os << ", ";
  os << p.second;
  os << "]";
  return os;
}
void solve() {
  string x, y;
  cin >> x >> y;
  int n;
  cin >> n;
  if (y.size() > x.size()) {
    cout << "0" << endl;
    return;
  }
  vector<vector<int>> sg(26);
  for (int i = 0; i < int(x.size()); i++) {
    if (x[i] != '?') {
      sg[x[i] - 'a'].push_back(i);
    }
  }
  vector<int> f(26, 0);
  for (int i = 0; i < int(y.size()); i++) {
    f[y[i] - 'a']++;
  }
  42;
  int ans = 0;
  for (int i = 0; i < int(x.size() - y.size() + 1); i++) {
    vector<int> f_n(26, 0);
    for (int k = 0; k < 26; k++) {
      int l1 = i;
      int l2 = i + int(y.size()) - 1;
      int it1 = upper_bound(sg[k].begin(), sg[k].end(), l2) - sg[k].begin();
      int it2 = lower_bound(sg[k].begin(), sg[k].end(), l1) - sg[k].begin();
      f_n[k] = it1 - it2;
    }
    bool ok = false;
    for (int k = 0; k < 26; k++) {
      if (f_n[k] > f[k]) {
        ok = true;
        break;
      }
    }
    if (!ok) ans++;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  T = 1;
  while (T--) {
    solve();
  }
}
