#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
vector<int> prefix_function(string s) {
  int n = (int)s.length();
  vector<int> pi(n);
  for (int i = 1; i < n; ++i) {
    int j = pi[i - 1];
    while (j > 0 && s[i] != s[j]) j = pi[j - 1];
    if (s[i] == s[j]) ++j;
    pi[i] = j;
  }
  return pi;
}
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size(), k = t.size();
  string ss = t + "#" + s;
  vector<int> b = prefix_function(ss);
  vector<int> pos(n + 1, 0);
  for (int i = k + 1; i < ss.size(); ++i) {
    if (b[i] == k) pos[i - k] = 1;
  }
  vector<long long> d(n + 1, 0);
  vector<long long> dpref(n + 1, 0);
  vector<long long> dprefpref(n + 1, 0);
  int lastpos = -1;
  for (int i = 1; i <= n; i++) {
    if (lastpos != -1) {
      d[i] = d[lastpos];
    }
    if (pos[i]) {
      if (lastpos != -1) {
        d[i] +=
            mod + mod + dprefpref[i - k] - dprefpref[lastpos - k] + i - lastpos;
        d[i] %= mod;
      } else {
        d[i] = i - k + 1;
        d[i] %= mod;
      }
      lastpos = i;
    }
    dpref[i] = mod + mod + d[i] + dpref[i - 1];
    dpref[i] %= mod;
    dprefpref[i] = mod + mod + dpref[i] + dprefpref[i - 1];
    dprefpref[i] %= mod;
  }
  cout << (mod + mod + dpref[n]) % mod;
  return 0;
}
