#include <bits/stdc++.h>
using namespace std;
vector<int> Zalgo(string s) {
  int L = -1, R = -1;
  vector<int> z(s.size() + 1);
  for (int i = 1; i < s.size(); i++) {
    if (i > R) {
      L = R = i;
      while (R < s.size() && s[R] == s[R - L]) R++;
      z[i] = R - L;
      R--;
    } else {
      if (z[i - L] < R - i + 1)
        z[i] = z[i - L];
      else {
        L = i;
        while (R < s.size() && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
  z[0] = s.size();
  return z;
}
string y;
string x, pat;
long long n, memo[(int)1e6 + 5][2];
vector<int> vec;
int nxt[(int)1e6 + 5];
const int mod = 1e9 + 7;
long long solve(int idx, bool f) {
  if (idx == ((int)((x).size()))) return 1;
  if (memo[idx][f] != -1) return memo[idx][f];
  long long ret = 0;
  if (f) {
    ret = (solve(idx + 1, f) + solve(idx + 1, 0)) % mod;
    if (nxt[idx] != -1) ret = (ret + solve(nxt[idx], 1)) % mod;
  } else {
    if (nxt[idx] != -1) ret = solve(nxt[idx], 1);
    ret = (ret + solve(idx + 1, 0)) % mod;
  }
  return memo[idx][f] = ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> x >> pat;
  n = ((int)((pat).size()));
  y = pat + "$" + x;
  vec = Zalgo(y);
  memset(memo, -1, sizeof memo);
  int last = -1;
  for (int i = ((int)((x).size())) - 1; i >= 0; i--) {
    if (vec[i + n + 1] == n) last = i + n;
    nxt[i] = last;
  }
  long long sum = 0;
  for (auto i = 0; i < (long long)(((int)((x).size()))); i++) {
    if (nxt[i] != -1) sum = (sum + solve(nxt[i], 1)) % mod;
  }
  cout << sum;
  return 0;
}
