#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll mod = 998244353;
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll ans = (n * (n + 1)) >> 1;
  ans -= ((n - k) * (n - k + 1)) >> 1;
  int l = 0;
  int r = n - 1;
  while (a[l] <= (n - k)) ++l;
  while (a[r] <= (n - k)) --r;
  vector<ll> b(n + 1, 0);
  for (int i = n - 1; i >= 0; --i) {
    if (a[i] > n - k) b[i] = 1;
    b[i] += b[i + 1];
  }
  ll prev = r + 1;
  ll count = 1;
  while (r >= l) {
    if (b[r] > b[r + 1]) {
      ll num = prev - r;
      prev = r;
      count = (1LL * num * count) % mod;
    }
    --r;
  }
  cout << ans << " " << count << "\n";
  return 0;
}
