#include <bits/stdc++.h>
using namespace std;
void JIZZ(string output = "") {
  cout << output;
  exit(0);
}
const long double PI = 3.14159265358979323846264338327950288;
const long double eps = 1e-10;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) cin >> a[i];
  vector<int> pos(n + 1);
  for (int i = 1; i <= n; ++i) pos[a[i]] = i;
  vector<int> key;
  for (int i = n; i >= n - k + 1; --i) key.push_back(pos[i]);
  sort(key.begin(), key.end());
  long long sum = 0, tot = 1;
  for (int i = n; i >= n - k + 1; --i) sum += i;
  for (int i = 1; i < (int)key.size(); ++i)
    tot = tot * (key[i] - key[i - 1]) % 998244353;
  cout << sum << ' ' << tot << endl;
}
