#include <bits/stdc++.h>
using namespace std;
char s[100002], t[100002];
long long res[100002], sum[100002];
bool b[100002];
int p[100002];
int main() {
  scanf("%s\n%s", s + 1, t + 1);
  int n = strlen(s + 1), m = strlen(t + 1);
  p[1] = 0;
  int tmp = 0;
  for (int i = 2; i <= m; ++i) {
    while (tmp > 0 && t[tmp + 1] != t[i]) tmp = p[tmp];
    if (t[tmp + 1] == t[i]) ++tmp;
    p[i] = tmp;
  }
  tmp = 0;
  for (int i = 1; i <= n; ++i) {
    while (tmp > 0 && t[tmp + 1] != s[i]) tmp = p[tmp];
    if (t[tmp + 1] == s[i]) ++tmp;
    if (tmp == m) b[i] = 1;
  }
  int sm = 0;
  for (int i = 1; i <= n; ++i) {
    if (b[i])
      res[i] = (i - m + 1 + sum[i - m] + res[i]) % 1000000007;
    else
      res[i] = res[i - 1];
    sm = (res[i] + sm) % 1000000007;
    sum[i] = (sum[i - 1] + sm) % 1000000007;
  }
  sm = 0;
  for (int i = 1; i <= n; ++i) sm = (res[i] + sm) % 1000000007;
  printf("%d", sm);
  return 0;
}
