#include <bits/stdc++.h>
using namespace std;
const int MX = 100005;
char s[MX], t[MX];
int st[MX];
int pi[MX];
long long dp[MX], sum[MX], sums[MX];
void calc_pi(char *p, int pn) {
  int i, q;
  pi[1] = q = 0;
  for (i = 1; i < pn; i++) {
    for (; q && p[q] != p[i]; q = pi[q])
      ;
    if (p[q] == p[i]) q++;
    pi[i + 1] = q;
  }
}
void KMP(char *t, int tn, char *p, int pn) {
  int i, q;
  calc_pi(p, pn);
  q = 0;
  for (i = 0; i < tn; i++) {
    for (; q && p[q] != t[i]; q = pi[q])
      ;
    if (p[q] == t[i]) q++;
    if (q == pn) {
      st[i - pn + 1] = i;
      q = pi[q];
    }
  }
}
int main() {
  memset(st, -1, sizeof(st));
  cin >> s >> t;
  KMP(s, strlen(s), t, strlen(t));
  int n = strlen(s);
  int save = n;
  for (int i = n - 1; i >= 0; i--) {
    if (st[i] != -1) {
      dp[i] = save - st[i] + sums[st[i] + 1] - sums[save + 1] + dp[i + 1];
      dp[i] %= 1000000007;
      save = st[i];
    } else {
      dp[i] = dp[i + 1];
    }
    sum[i] = sum[i + 1] + dp[i];
    sums[i] = sums[i + 1] + sum[i];
    sums[i] %= 1000000007;
    sum[i] %= 1000000007;
  }
  long long rlt = 0;
  for (int i = 0; i < n; i++) {
    rlt += dp[i];
    rlt %= 1000000007;
  }
  cout << rlt % 1000000007 << endl;
}
