#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10005;
const int N = 500000;
int F[N], n, m;
void kmpPreprocess(const string& P) {
  int i = 0, j = -1;
  F[0] = -1;
  while (i < m) {
    while (j >= 0 && P[i] != P[j]) j = F[j];
    i++;
    j++;
    F[i] = j;
  }
}
vector<int> kmpSearch(const string& T, const string& P) {
  n = T.length();
  m = P.length();
  kmpPreprocess(P);
  int i = 0, j = 0;
  vector<int> res;
  while (i < n) {
    while (j >= 0 && T[i] != P[j]) j = F[j];
    i++;
    j++;
    if (j == m) {
      res.push_back(i - j);
      j = F[j];
    }
  }
  return res;
}
int pd[N + 5], sum[N + 5], sum2[N + 5];
const int MOD = 1000000007;
int main() {
  string s, t;
  while (cin >> s >> t) {
    vector<int> v = kmpSearch(s, t);
    reverse(v.begin(), v.end());
    int id = -1;
    pd[(int)s.size()] = sum[(int)s.size()] = 0;
    sum2[(int)s.size()] = 1;
    for (int i = (int)s.size() - 1; i >= 0; i--) {
      if (id + 1 < (int)v.size())
        if (v[id + 1] >= i) id++;
      if (id == -1) {
        pd[i] = sum[i] = 0;
      } else {
        int p = v[id] + (int)t.size();
        pd[i] = sum2[p];
        pd[i] %= MOD;
      }
      sum[i] = (sum[i + 1] + pd[i]) % MOD;
      sum2[i] = (sum2[i + 1] + 1 + sum[i]) % MOD;
    }
    cout << sum[0] << endl;
  }
}
