#include <bits/stdc++.h>
using namespace std;
string s, t;
long long nx[200005], ok[200005], d[200005], d2[200005], sum[200005],
    mod = 1e9 + 7;
void getnextval() {
  nx[0] = -1;
  long long i = 0, j = -1, len = t.length();
  while (i < len) {
    if (j == -1 || t[i] == t[j]) {
      i++;
      j++;
      if (t[i] != t[j])
        nx[i] = j;
      else
        nx[i] = nx[j];
    } else
      j = nx[j];
  }
}
void kmp(long long start) {
  getnextval();
  long long i, j = 0;
  for (i = start; i < s.length(); i++) {
    while (j > 0 && t[j] != s[i]) j = nx[j];
    if (j == -1 || s[i] == t[j]) j++;
    if (j == t.length()) {
      ok[i] = 1;
      j = nx[j];
    }
  }
}
int main() {
  cin >> s >> t;
  kmp(0);
  for (long long i = 1; i <= s.length(); i++) {
    if (!ok[i - 1])
      d[i] = d[i - 1];
    else
      d[i] = sum[i - t.length()] + i - t.length() + 1;
    d2[i] = (d2[i - 1] % mod + d[i] % mod) % mod;
    sum[i] = (sum[i - 1] % mod + d2[i] % mod) % mod;
  }
  cout << d2[s.length()] % mod << endl;
}
