#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)1e5 + 5, MOD = (int)1e9 + 7;
inline int add(int x, int y) {
  int res = x + y;
  if (res >= MOD) res -= MOD;
  return res;
}
inline int sub(int x, int y) { return add(x - y, MOD); }
inline int mul(int x, int y) { return (x * 1LL * y) % MOD; }
int b[MAX_N], good[MAX_N];
void kmpPreprocess(const string &P) {
  int i = 0, j = -1;
  b[0] = -1;
  while (i < (int)P.size()) {
    while (j >= 0 && P[i] != P[j]) j = b[j];
    i++, j++;
    b[i] = j;
  }
}
void process(const string &T, const string &P) {
  int i = 0, j = 0;
  while (i < (int)T.size()) {
    while (j >= 0 && T[i] != P[j]) j = b[j];
    i++, j++;
    if (j == (int)P.size()) good[i - 1] = 1, j = b[j];
  }
}
int main() {
  string T, P;
  cin >> T >> P;
  int n = (int)T.size(), m = (int)P.size();
  kmpPreprocess(P);
  process(T, P);
  vector<int> a(n, 0), Q1(n, 0), Q2(n, 0);
  for (int i = 0; i < n; i++) {
    if (!good[i]) {
      if (i - 1 >= 0) a[i] = a[i - 1];
    } else {
      if (i - m >= 0)
        a[i] = add(Q2[i - m], i - m + 2);
      else
        a[i] = i - m + 2;
    }
    if (i - 1 >= 0)
      Q1[i] = add(Q1[i - 1], a[i]);
    else
      Q1[i] = a[i];
    if (i - 1 >= 0)
      Q2[i] = add(Q2[i - 1], Q1[i]);
    else
      Q2[i] = Q1[i];
  }
  int res = 0;
  for (int i = 0; i < n; i++) res = add(res, a[i]);
  printf("%d\n", res);
  return 0;
}
