#include <bits/stdc++.h>
using namespace std;
int a[30], b[30];
int main() {
  string s1, s2;
  int ans = 0;
  cin >> s1 >> s2;
  for (int i = 0; i < s2.size(); i++) {
    b[s2[i] - 'a']++;
  }
  int f;
  for (int i = 0; i < s1.size(); i++) {
    if (s1[i] - 'a' >= 0) a[s1[i] - 'a']++;
    f = 1;
    if (i + 1 >= s2.size()) {
      for (int j = 0; j < 26; j++) {
        if (a[j] > b[j]) {
          f = 0;
          break;
        }
      }
      if (f) ans++;
      if (s1[i + 1 - s2.size()] - 'a' >= 0) a[s1[i + 1 - s2.size()] - 'a']--;
    }
  }
  cout << ans << endl;
  return 0;
}
