#include <bits/stdc++.h>
using namespace std;
int dir[4][2] = {0, 1, 1, 0, -1, 0, 0, -1};
char s[100010], ss[100010];
long long dp[100010], l[100010], sum[100010], MOD = 1e9 + 7;
void getNext(char *s, int *next) {
  int j, k;
  next[0] = -1;
  j = 0;
  k = -1;
  while (s[j] != '\0') {
    if (k == -1 || s[k] == s[j]) {
      j++;
      k++;
      next[j] = k;
    } else
      k = next[k];
  }
}
int Match(char *s1, char *s2) {
  int next[100010];
  int i, j;
  i = j = 0;
  getNext(s2, next);
  int l1 = strlen(s1), l2 = strlen(s2);
  while (i < l1) {
    if (j == -1 || s1[i] == s2[j]) {
      i++;
      j++;
    } else
      j = next[j];
    if (j == l2) l[i] = i - l2 + 1;
  }
  return 0;
}
int main() {
  memset(s, 0, sizeof(s));
  memset(ss, 0, sizeof(ss));
  while (scanf("%s", s) != EOF) {
    scanf("%s", ss);
    memset(l, 0, sizeof(l));
    Match(s, ss);
    int L = strlen(s);
    for (int i = 1; i <= L; ++i) {
      if (l[i] == 0) l[i] = l[i - 1];
    }
    memset(dp, 0, sizeof(dp));
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i <= L; ++i) {
      dp[i] = dp[i - 1];
      if (l[i] > 0) {
        dp[i] += sum[l[i] - 1] + l[i];
      }
      dp[i] %= MOD;
      sum[i] = (sum[i - 1] + dp[i]) % MOD;
    }
    printf("%lld\n", dp[L]);
  }
  return 0;
}
