#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool uin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int P = 1000000000 + 7;
void add(int& x, int y) {
  if ((x += y) >= P) x -= P;
}
int sum(int x, int y) {
  add(x, y);
  return x;
}
vector<long long> getz(const string& s) {
  int n = (int)s.length();
  vector<long long> z(n);
  for (int i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, (int)z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
void solve() {
  string sa, sb;
  cin >> sa >> sb;
  int n = sa.length(), m = sb.length();
  vector<long long> z = getz(sb + "#" + sa);
  vector<long long> li(n + 1);
  for (int i = 1; i <= (int)(n); ++i) {
    int pos = m + i;
    if (z[pos] >= m) {
      li[i + m - 1] = i;
    }
  }
  for (int i = 1; i <= (int)(n); ++i) li[i] = max(li[i], li[i - 1]);
  vector<long long> ans(n + 1, 0), sans(n + 1, 0);
  ans[0] = sans[0] = 1;
  for (int i = 1; i <= (int)(n); ++i) {
    if (li[i]) {
      ans[i] = sum(ans[i - 1], sans[li[i] - 1]);
    } else {
      ans[i] = ans[i - 1];
    }
    sans[i] = sum(sans[i - 1], ans[i]);
  }
  cout << sum(ans[n], P - 1) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed;
  cout.precision(15);
  cerr << fixed;
  cerr.precision(15);
  solve();
  return 0;
}
