#include <bits/stdc++.h>
using namespace std;
long long int modulo = 1e9 + 7;
string s, t;
int previa[1000000];
long long int manerascon[1000000];
long long int manerassin[1000000];
long long int manerashas[1000000];
int main() {
  ios::sync_with_stdio(false);
  cin >> s >> t;
  string w = t + "#" + s;
  {
    vector<int> anterior(int(w.size()));
    int j = -1;
    anterior[0] = -1;
    for (int i = 1; i < int(w.size()); i++) {
      while (j != -1 and w[j + 1] != w[i]) j = anterior[j];
      if (w[j + 1] == w[i]) j++;
      anterior[i] = j;
      if (i > int(t.size()) and anterior[i] == int(t.size()) - 1)
        previa[i - int(t.size())] = i - int(t.size());
    }
  }
  for (int i = 1; i <= int(s.size()); i++)
    previa[i] = max(previa[i], previa[i - 1]);
  for (int i = 1; i <= int(s.size()); i++) {
    if (previa[i]) {
      int ii = previa[i] - int(t.size());
      manerashas[i] = (manerassin[ii] + manerascon[ii] + ii + 1) % modulo;
      manerassin[i] = (manerashas[i] + manerassin[i - 1]) % modulo;
      manerascon[i] = (manerascon[i - 1] + manerassin[i - 1]) % modulo;
    }
  }
  cout << manerassin[int(s.size())] << endl;
}
