#include <bits/stdc++.h>
using namespace std;
void _print(long long x) { cerr << x; }
void _print(double x) { cerr << x; }
void _print(char x) { cerr << x; }
void _print(string x) { cerr << x; }
void _print(bool x) { cerr << x; }
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> v) {
  cerr << "[ ";
  for (auto x : v) {
    _print(x);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> v) {
  cerr << "[ ";
  for (T i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> v) {
  cerr << "[ ";
  for (auto i : v) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
void initialMethod() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
}
void fun() {
  long long n, k;
  cin >> n >> k;
  vector<string> v(n);
  for (auto &x : v) {
    cin >> x;
  }
  string password;
  cin >> password;
  long long smaller = 0, equalSize = 0;
  for (long long i = 0; i < n; i++) {
    if (v[i].size() < password.size()) {
      smaller++;
    }
    if (v[i].size() == password.size()) {
      equalSize++;
    }
  }
  long long minAttempt = smaller + 1, maxAttempt = smaller + equalSize;
  cout << (minAttempt + ((minAttempt - 1) / k) * 5) << " "
       << (maxAttempt + ((maxAttempt - 1) / k) * 5);
}
int32_t main() {
  initialMethod();
  long long t = 1;
  while (t-- > 0) {
    fun();
  }
}
