#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  set<long long> p;
  bool f1 = 0;
  long long count = 0;
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    p.insert(temp);
    if (temp > n - k) f1 = 1;
    if (f1) {
      if (temp > n - k) {
        ans = (ans * (count + 1)) % 998244353;
        count = 0;
      } else
        count = (count + 1) % 998244353;
    }
  }
  cout << n * (n + 1) / 2 - (n - k) * ((n - k) + 1) / 2 << ' ' << ans;
}
