#include<bits/stdc++.h> 
using namespace std; 
#define int long long  

map<int, map<int, int> > dp1;
map<int, map<int, int> > dp2;
int mo=1000000007;
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    int x[n+5];
    int y[m+5];
    int dpx[n+5];
    int dpy[m+5];
    for(int i=0;i<n;i++)
        cin>>x[i];
    for(int j=0;j<m;j++)
        cin>>y[j];
    sort(x,x+n);
    int mo=1000000007;
    int sx=0,sy=0;
    for(int i=1;i<n;i++)
        sx=(sx + (((((x[i]-x[i-1])*i)%mo)*(n-i))%mo) )%mo;
    sort(y,y+m);
    for(int i=1;i<m;i++)
        sy=(sy + (((((y[i]-y[i-1])*i)%mo)*(m-i))%mo) )%mo;

    //cout<<sx<<" "<<sy<<" ";
    cout<<(sx*sy)%mo;
}
#include <bits/stdc++.h>

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

double e(ll x) {
  ll sum = x * (x + 1) / 2;
  return (double)sum / (double)x;
}

void solve(ll N, ll K, std::vector<ll> p) {
  vector<ll> acc(N + 1);
  acc.at(0) = 0;
  rep(i, N) acc.at(i + 1) = acc.at(i) + p.at(i);

  ll idx = -1;
  ll mx = -1;

  rep(i, N - K + 1) {
    ll s = acc.at(i + K) - acc.at(i);
    if (s > mx) {
      mx = s;
      idx = i;
    }
  }

  double ans = 0.0;
  FOR(i, idx, idx + K) { ans += e(p.at(i)); }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  std::vector<ll> p(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &p[i]);
  }
  solve(N, K, std::move(p));
  return 0;
}
