#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(0);
  int n, k;
  cin >> n >> k;
  string s;
  vector<int> m(1010, 0);
  for (int i = 0; i < n; ++i) {
    cin >> s;
    ++m[(s).size()];
  }
  int ps, mn = 0, mx = 0;
  string pass;
  cin >> pass;
  ps = (pass).size();
  for (int i = 0; i < ps; ++i) mn += m[i];
  mx = mn + m[ps] - 1;
  mn += 5 * (mn / k) + 1;
  mx += 5 * (mx / k) + 1;
  cout << mn << " " << mx;
  return 0;
}
