Xorgon is an extremely delicious treat formed by the sequence $S$ of binary integers $s_1, s_2,..,s_N$. A really interesting property found in a Xorgon is that the xor of all elements in any contiguous subsequence of length $K$ in $S$ will result in $1$.   
Chef has been asked to prepare a Xorgon. However, he has at his disposal a binary sequence $X$ containing the binary integers $x_1, x_2, ...x_N$. To prepare a Xorgon, the chef may flip the value of as many binary digits in $X$ as required.(i.e. turn a $1$ to a $0$ and $0$ to a $1$). Unfortunately, flipping a digit takes a lot of time and the chef has to serve many orders. Can you help the chef calculate the minimum number of flips required to cook a Xorgon from the given $X$?

-----Input:-----
- The first line will contain two space-separated integers $N, K$.
- Next line contains N space-separated integers $x_1, x_2, ...,x_N$. 

-----Output:-----
Output in a single line minimum number of flips required to turn $X$ into a Xorgon.

-----Constraints-----
- $1 \leq K \leq N \leq 3*10^6$
- $0 \leq x_i \leq 1$

-----Sample Input:-----
7 5
1 0 0 1 1 1 1

-----Sample Output:-----
1

-----EXPLANATION:-----
Flip the last bit from 1 to 0 to obtain a Xorgon.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# cook your dish here\nfrom sys import stdin,stdout\n\na0=0\na1=1\nn,k=stdin.readline().strip().split(\' \')\nn,k=int(n),int(k)\n\narr=list(map(int,stdin.readline().strip().split(\' \')))\n\n\n\ndef solve(n,k,arr):\n sol=[]\n\n l=0;u=k;\n\n\n while l!=u:\n   sol.append(arr[l:min(len(arr),u)])\n   l=min(l+k,len(arr))\n   u=min(u+k,len(arr))\n   \n tiwari=[]\n for i in range(k):\n   titi=0\n   gao=0\n   for j in range(len(sol)):\n    if len(sol[j])>i:\n     if sol[j][i]==0:\n      titi+=1\n     else:\n      gao+=1\n   tiwari.append((titi,gao))\n\n minflip=(-1,-1)\n ans=0\n ctr=0\n for i in tiwari:\n   if i[0]<i[1]:\n    ans+=i[0]\n    ctr+=(1*a1+a0*a1)*a1\n    if i[1]<minflip[0] or minflip[0]==-1:\n     minflip=(i[1],i[0])\n   else:\n    ans+=i[1]\n    if i[0]<minflip[0] or minflip[0]==-1:\n     minflip=(i[0],i[1])\n #print(ans,ctr)\n #print(tiwari)\n #print(minflip)\n if ctr%2==0:\n   ans+=minflip[0]\n   ans-=minflip[1]\n\n\n stdout.write(str(ans)+"\\n")\n\nsolve(n,k,arr)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13165