#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000000 + 7;
bitset<100005> KMP(string s, string w) {
  int slen = s.length(), wlen = w.length();
  vector<int> T(w.size());
  T[0] = 0;
  for (int i = 1, len = 0; i < wlen;) {
    if (w[i] == w[len]) {
      len++;
      T[i] = len;
      i++;
    } else if (len != 0) {
      len = T[len - 1];
    } else {
      T[i] = 0;
      i++;
    }
  }
  bitset<100005> answer;
  for (int si = 0, wi = 0; si < slen;) {
    if (s[si] == w[wi]) {
      ++si;
      ++wi;
    }
    if (wi == wlen) {
      answer[si - 1] = 1;
      wi = T[wi - 1];
    } else if (si < slen && w[wi] != s[si]) {
      if (wi != 0) {
        wi = T[wi - 1];
      } else {
        ++si;
      }
    }
  }
  return answer;
}
int main() {
  string s, t;
  cin >> s >> t;
  int slen = s.length(), tlen = t.length();
  bitset<100005> goodIndices = KMP(s, t);
  vector<int> a(s.length() + 2), pa(s.length() + 2), ppa(s.length() + 2);
  a[0] = pa[0] = ppa[0] = 1;
  for (int i = 0; i < slen; ++i) {
    if (goodIndices[i]) {
      a[i + 1] = ppa[i - tlen + 1];
    } else if (i == 0) {
      a[i + 1] = 0;
    } else {
      a[i + 1] = a[i];
    }
    pa[i + 1] = (a[i + 1] + pa[i]) % mod;
    ppa[i + 1] = (pa[i + 1] + ppa[i]) % mod;
  }
  cout << (pa[slen] + mod - 1) % mod << endl;
  return 0;
}
