#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / gcd(a, b)) * b;
}
template <class T, class X>
inline bool getbit(T a, X i) {
  T t = 1;
  return ((a & (t << i)) > 0);
}
template <class T, class X>
inline T setbit(T a, X i) {
  T t = 1;
  return (a | (t << i));
}
template <class T, class X>
inline T resetbit(T a, X i) {
  T t = 1;
  return (a & (~(t << i)));
}
inline long long getnum() {
  char c = getchar();
  long long num, sign = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (num = 0; c >= '0' && c <= '9';) {
    c -= '0';
    num = num * 10 + c;
    c = getchar();
  }
  return num * sign;
}
inline long long power(long long a, long long b) {
  long long multiply = 1;
  for (int i = (0); i < (b); i++) {
    multiply *= a;
  }
  return multiply;
}
string s, t;
long long up[100002], thash, shash[100002];
bool exist[100002];
long long aux[100002], dp[100002], help[100002];
int main() {
  int test, cases = 1;
  cin >> s >> t;
  s = '#' + s;
  int l = t.size(), n = s.size() - 1;
  up[0] = 1;
  for (int i = 1; i < 100002; i++) up[i] = (up[i - 1] * 43) % 1000000007LL;
  for (int i = (0); i < (l); i++) {
    thash = (thash + (t[i] - 'a' + 1) * up[i]) % 1000000007LL;
  }
  for (int i = (1); i < (n + 1); i++) {
    shash[i] = (shash[i - 1] + (s[i] - 'a' + 1) * up[i - 1]) % 1000000007LL;
  }
  for (int i = n; i >= l; i--) {
    long long now = (shash[i] - shash[i - l]) % 1000000007LL;
    if (now < 0) now += 1000000007LL;
    long long temp = (thash * up[i - l]) % 1000000007LL;
    if (temp == now) {
      exist[i] = true;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (exist[i]) {
      dp[i] = help[i - l] + i - l + 1;
      dp[i] %= 1000000007LL;
    } else
      dp[i] = dp[i - 1];
    aux[i] = dp[i];
    aux[i] += aux[i - 1];
    aux[i] %= 1000000007LL;
    help[i] = help[i - 1] + aux[i];
    help[i] %= 1000000007LL;
  }
  long long ans = 0;
  for (int i = (1); i < (n + 1); i++) ans = (ans + dp[i]) % 1000000007LL;
  cout << ans << "\n";
  return 0;
}
