#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  vector<ll> a(n);
  string u = t + '@' + s;
  vector<int> kmp(u.size());
  for (int i = 1; i < (int)u.size(); i++) {
    int j = kmp[i - 1] - 1;
    while (j >= 0 && u[j + 1] != u[i]) j = kmp[j] - 1;
    if (j >= 0)
      kmp[i] = j + 2;
    else
      kmp[i] = u[i] == u[0];
  }
  vector<ll> q(n), q1(n);
  for (int i = 0; i < n; i++) {
    if (kmp[i + t.size() + 1] == (int)t.size()) {
      a[i] = ((i - (int)t.size() >= 0 ? q1[i - (int)t.size()] : 0) + a[i] + i -
              t.size() + 2) %
             mod;
    } else if (i) {
      a[i] = a[i - 1];
    }
    q[i] = ((i ? q[i - 1] : 0) + a[i]) % mod;
    q1[i] = ((i ? q1[i - 1] : 0) + q[i]) % mod;
  }
  cout << q[n - 1];
}
