#include <bits/stdc++.h>
using namespace std;
long long P = 1000000007;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  long long b = n, ans = 0;
  long long brr[k + 1];
  long long a = 0;
  for (long long i = 0; i < k; ++i) {
    ans += b;
    b--;
    brr[i] = 1;
  }
  brr[k] = 1;
  long long arr[n];
  for (long long j = 0; j < n; ++j) {
    cin >> arr[j];
    if (arr[j] <= n - k) {
      brr[a]++;
    } else {
      a++;
    }
  }
  long long ans2 = 1;
  for (long long i = 1; i <= k - 1; ++i) {
    ans2 = (ans2 * brr[i]) % 998244353;
  }
  cout << ans << " " << ans2;
}
