#include <bits/stdc++.h>
using namespace std;
const bool testing = false;
const long long M = 1000 * 1000 * 1000 + 7;
static char v[100003], S[100003];
static int F[100003];
static long long d[100003];
static long long u[100003];
void build_failure_function() {
  memset(F, 0, sizeof(F));
  int k = 0;
  for (int i = 2; S[i]; i++) {
    while (k > 0 && S[i] != S[k + 1]) k = F[k];
    if (S[i] == S[k + 1]) k++;
    F[i] = k;
  }
}
long long Knuth_Morris_Pratt() {
  long long ans = 0;
  build_failure_function();
  int k = 0;
  for (int i = 1; v[i]; i++) {
    while (k > 0 && v[i] != S[k + 1]) k = F[k];
    if (v[i] == S[k + 1]) k++;
    if (k && !S[k + 1]) {
      d[i] += i - k + 1;
      d[i] += u[i - k];
      d[i] %= M;
    } else
      d[i] = d[i - 1];
    ans += d[i];
    ans %= M;
    u[i] = (u[i - 1] + ans) % M;
  }
  return ans;
}
void program() {
  scanf("%s%s", v + 1, S + 1);
  memset(d, 0, sizeof(d));
  memset(u, 0, sizeof(u));
  std::cout << Knuth_Morris_Pratt() << std::endl;
}
int main() {
  if (!testing) {
    program();
    return 0;
  }
  FILE* fin = NULL;
  return 0;
}
