#include <bits/stdc++.h>
using namespace std;
double getTime() { return clock() / (double)CLOCKS_PER_SEC; }
void read(){};
template <typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}
void print(){};
template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}
const long long MOD = 998244353;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<pair<long long, int>> v;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    v.push_back({x, i});
  }
  sort(v.rbegin(), v.rend());
  long long sum = 0;
  long long ways = 1ll;
  vector<long long> ok;
  for (int i = 0; i < k; i++) {
    sum += v[i].first;
    ok.push_back(v[i].second);
  }
  sort(ok.begin(), ok.end());
  for (int i = 0; i + 1 < k; i++) {
    ways = (ways * (ok[i + 1] - ok[i])) % MOD;
  }
  cout << sum << ' ' << ways << '\n';
}
int main() {
  int t;
  t = 1;
  while (t--) solve();
}
