#include <bits/stdc++.h>
using namespace std;
const int MN = 100111;
const int MOD = 1000000007;
string s, t;
long long f[MN], sum[MN], sumSum[MN], next_[MN], first[MN];
int ls, lt;
void init() {
  memset(next_, 0, sizeof next_);
  memset(first, 0, sizeof first);
  int j = 0;
  next_[1] = 0;
  for (int i = (2), _b = (lt); i <= _b; i++) {
    while (j > 0 && t[i] != t[j + 1]) j = next_[j];
    if (t[i] == t[j + 1]) ++j;
    next_[i] = j;
  }
  j = 0;
  for (int i = (1), _b = (ls); i <= _b; i++) {
    while (j > 0 && s[i] != t[j + 1]) j = next_[j];
    if (s[i] == t[j + 1]) ++j;
    if (j == lt) {
      first[i] = i - lt + 1;
      j = next_[j];
    }
  }
  for (int i = (1), _b = (ls); i <= _b; i++)
    if (first[i] == 0) first[i] = first[i - 1];
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(NULL);
  cout << (fixed) << setprecision(6);
  while (cin >> s >> t) {
    ls = s.length(), lt = t.length();
    s = " " + s;
    t = " " + t;
    init();
    memset(f, 0, sizeof f);
    memset(sum, 0, sizeof sum);
    memset(sumSum, 0, sizeof sumSum);
    for (int i = (1), _b = (ls); i <= _b; i++) {
      if (first[i]) {
        f[i] = (sumSum[first[i] - 1] + first[i]) % MOD;
      }
      sum[i] = (sum[i - 1] + f[i]) % MOD;
      sumSum[i] = (sumSum[i - 1] + sum[i]) % MOD;
    }
    cout << sum[ls] << endl;
  }
  return 0;
}
