#include <bits/stdc++.h>
using namespace std;
inline void kmp(const char *s, int *p, int n) {
  p[0] = -1;
  for (int i = 1; i < n; i++) {
    int x = p[i - 1];
    while (x != -1 && s[x + 1] != s[i]) {
      x = p[x];
    }
    if (s[x + 1] == s[i]) {
      p[i] = x + 1;
    } else {
      p[i] = -1;
    }
  }
  for (int i = 0; i < n; i++) p[i]++;
}
inline void kmp(const char *s, int *p) { kmp(s, p, strlen(s)); }
inline void findAllOccurrences(const char *where, int size_where,
                               const char *what, int size_what,
                               std::vector<int> &result) {
  int total_size = size_what + size_where + 1;
  char *s = new char[total_size + 1];
  int *p = new int[total_size];
  for (int i = 0; i < size_what; i++) s[i] = what[i];
  s[size_what] = '$';
  for (int i = 0; i < size_where; i++) s[i + 1 + size_what] = where[i];
  s[total_size] = 0;
  kmp(s, p);
  for (int i = size_what + 1; i < total_size; i++) {
    if (p[i] == size_what) {
      result.push_back(i - 2 * size_what);
    }
  }
  delete (s);
  delete (p);
}
const int MOD = 1e9 + 7;
const int N = 211111;
char s[N], t[N];
int dp[N], cdp[N];
int main() {
  vector<int> ocs;
  gets(s);
  gets(t);
  int n = strlen(s), m = strlen(t);
  findAllOccurrences(s, n, t, m, ocs);
  if ((int)(ocs.size()) == 0) {
    cout << 0 << endl;
    return 0;
  }
  memset(dp, 0, sizeof(dp));
  memset(cdp, 0, sizeof(cdp));
  dp[n] = 1;
  cdp[n] = 1;
  for (int i = n - 1; i >= 0; i--) {
    int l = -1, r = (int)(ocs.size()) - 1;
    while (r - l > 1) {
      int tt = (l + r) / 2;
      if (ocs[tt] < i) {
        l = tt;
      } else {
        r = tt;
      }
    }
    assert(r >= 0 && r < ocs.size());
    if (i <= ocs[r]) {
      dp[i] = (cdp[ocs[r] + m] + dp[i + 1]) % MOD;
    } else {
      dp[i] = 1;
    }
    cdp[i] = (cdp[i + 1] + dp[i]) % MOD;
  }
  cout << (dp[0] - 1 + MOD) % MOD << endl;
  return 0;
}
