#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e9;
const long long MB = 20;
const long long MOD = 998244353;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long mx = n - k;
  long long last = -1;
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    if (a[i] <= mx) continue;
    if (last != -1) ans = ans * (i - last) % MOD;
    last = i;
  }
  long long sum = 0;
  for (long long i = mx + 1; i <= n; i++) sum += i;
  cout << sum << " " << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
}
