#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s, t;
  int a[200005] = {};
  bool c[100005] = {};
  int d[100005] = {}, e[100005] = {}, f[100005] = {};
  d[0] = e[0] = f[0] = 1;
  cin >> s >> t;
  int l = (int)t.length();
  t = '!' + t + '@' + s;
  for (int i = 1; i <= t.length() - 1; i++) {
    if (t[i] == t[a[i - 1] + 1] && i != a[i - 1] + 1)
      a[i] = a[i - 1] + 1;
    else {
      int b = i - 1;
      while (b) {
        b = a[b];
        if (t[b + 1] == t[i]) {
          a[i] = b + 1;
          break;
        }
      }
    }
  }
  for (int i = l + 2; i < t.length(); i++)
    if (a[i] == l) c[i - l - 1] = 1;
  bool o = 0;
  for (int i = 1; i <= s.length(); i++) {
    if (c[i])
      d[i] = f[i - l], o = 1;
    else if (o)
      d[i] = d[i - 1];
    e[i] = e[i - 1] + d[i];
    if (e[i] >= 1000000007) e[i] -= 1000000007;
    f[i] = f[i - 1] + e[i];
    if (f[i] >= 1000000007) f[i] -= 1000000007;
  }
  if (!e[s.length()])
    cout << 1000000007 - 1;
  else
    cout << e[s.length()] - 1;
}
